Subject Re: evaltags in a custom report
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 6 May 2021 18:25:20 +0200
Newsgroups dbase.getting-started

On 2021/05/06 16:22, Charlie wrote:
> I am working with a custom report and have a field that evidently has evaltags in it.   The field is character and 254 long.   In a form you can set the evaltag property to fix this but I see nothing in this custom report  .crp to fix this problem.  Is there a fix for it in reports somewhere?  Thanks much for any help!
>

On a form you would display your field in a editor control which can
evaluate a limited number of HTML tags.

In a report you render the field using a text object which doesn't have
the ability to evaluate HTML tags.

A possible answer is to add a new field to your table and populate it
with the tags stripped from the original field.  Use the new field in
your report.

I've use regular expressions to add HTML tags to text but I've never
tried stripping the tags.  The following code is completely untested.
There are no guarantees whatsoever that it will actually work.  Make
sure you have your table backed up before you try it.

You will need to change 'whatever' to your table name (without the .dbf)
and 'oldfield' and 'newfield' to the actual field names.


***************
alter table whatever add newfield chr(254)
oRegExp  = new OLEAutoClient("VBScript.RegExp")
oRegExp.global = true
oRegExp.ignoreCase = true
oRegExp.pattern = "<[^>]*>"
use whatever
replace all newfield with oRegExp.replace(oldfield,"")
use
***************

If it doesn't work please post an example of the original text and the
output.  I'm not very experienced with regular expressions but if I can
see what is being missed I may be able to refine the pattern.  (No
promises.  You may wind up having to do this by hand. :-( )


Mervyn.