filter at variable *

Please i need help

i have seriescode is a variable text 30

i am getting a value in it always

I need then to filter in field to all fileld that = variable start

I wrote like this but doesnot work

record.setfilter( field, ‘%1*’ , seriescode) ;

thank you in advance

Try

record.setfilter( field, ‘@%1*’ , seriescode) ;

Thats makes it case insensive.

/TH

Hi Tony ,

I 've tried it but it doesn’t work … i a wondering ? why ?

thank for your support

Can you post me the surrounding code please?

/TH

Try this: record.setfilter( field, seriescode + ‘*’ ) ;

Hi Tony Here is the coding …if the bold statement will work … then i can remove the following 3 statements after the bold one … thank you for help

series header is table 308 series line is table 309 genjour is table 81

seriesheader.SETCURRENTKEY(seriesheader.Code) ;
seriesheader.FIND(’-’) ;
seriesheader.SETRANGE(seriesheader.“Date Order”, TRUE);
IF seriesheader.FIND(’-’) THEN BEGIN
REPEAT
CLEAR(seriescode) ;
seriesline.SETCURRENTKEY(“Series Code”,“Line No.”) ;
seriesline.FIND(’-’) ;
seriesline.SETRANGE(seriesline.“Series Code” , seriesheader.Code);
IF seriesline.FIND(’-’) THEN BEGIN
REPEAT
genjour.RESET ;
genjour.SETCURRENTKEY(“Journal Template Name”,“Journal Batch Name”,“Posting Date”,
“Document No.”,“Account No.”,“Currency Code”,“Shortcut Dimension 1 Code”);
genjour.SETRANGE( genjour.“Posting Date”, seriesline.“Starting Date”);
len := STRLEN(seriesline.“Starting No.”);
seriescode := COPYSTR(seriesline.“Starting No.”, 1,len-13);
// genjour.SETFILTER(genjour.“Document No.” ,’@%1*’, seriescode); // if then statement works
IF seriescode = ‘RV’ THEN genjour.SETFILTER(genjour.“Document No.” ,‘RV*’); // then this statement will remove
IF seriescode = ‘JV’ THEN genjour.SETFILTER(genjour.“Document No.” ,‘JV*’); // then this statement will remove
IF seriescode = ‘PV’ THEN genjour.SETFILTER(genjour.“Document No.” ,‘PV*’); // then this statement will remove
maxdoc:=‘0000’ ;
IF genjour.FIND(’-’) THEN BEGIN
REPEAT
maxstring := COPYSTR(genjour.“Document No.”, 12,4);
IF maxstring > maxdoc THEN maxdoc:= maxstring ;
UNTIL genjour.NEXT= 0 ;
END;
seriesline.“Last No. Used”:= COPYSTR(seriesline.“Starting No.”,1,11) + maxdoc ;
seriesline.“Last Date Used”:= genjour.“Posting Date” ;
seriesline.MODIFY ;
UNTIL seriesline.NEXT= 0;
END;
UNTIL seriesheader.NEXT = 0 ;
END;
MESSAGE ('donnnnnnnnnne)

thank you … it works …thank you Pduck

Best way is :

SETFILTER(“The Field”,’%1’,TheValue + ‘*’);

This because the second parameter (’%1’ in this case) is the formatting string and the parameters after that one the parameters in the formatting string.

Another example:

All values from 100 to 999 or 0

SETFILTER(“The Field”,’%1…%2|%3’,100,999,0);