String Extraction

Hi all,

I’d like to extract all strings whose description start with “WR” , so that they are not printed in my report.

I’ve tried statements like: IF record.description = ‘WR*’ THEN


Qn, how do I extract such strings and avoid printing them.


You should use the function STRPOS for that:

STRPOS (String)

Use this function to search for a substring inside a string.## Position := STRPOS(String, SubString)


Data type: integer

The position of SubString in String. If the system cannot find SubString, it returns zero (0).


Data type: text constant or code

The string you want to search in.


Data type: text constant or code

The string you want to search for. The STRPOS function is case-sensitive.


The STRPOS function only returns the position of the first occurrence of the substring.

In your case this would be:

If STRPOS(record.description,‘WR’) = 1 then

Hi Joerg.

Thanks for the insight! It works!!

Or also:

IF COPYSTR(record.description,1,2) = ‘WR’ then


And maybe, you should put (in case you can have both upper- as lowercase:

IF UPPERCASE(COPYSTR(record.description,1,2)) = ‘WR’ then


You don’t have to use the STRPOS function. You can use filters, and by using filters, you can avoid having to loop through all of your records.

Record.setfilter(descriptoin,’%1’,‘WR*’) ;

Record.findset(false,false) ;

will return all records whose description starts with WR.

Unfortunately, I do not thing you can use the “NOT” operator with the “*” operator.