ValueFitsFilter function

hi! i’ve got a filter in a text variable. lets say DateFilter: Text200. now id like to check if a variable of type Date fits into DAteFilter. kind of like a funktion call to IfIsInsideFilter(Date, DateFilter) ore something like that. got any clues?

OBJECT Form 50000 Check Value is in Filter { OBJECT-PROPERTIES { Datum=03.12.03; Zeit=10:33:47; Geändert=Ja; Versions Liste=; } PROPERTIES { Width=8000; Height=8000; OnOpenForm=BEGIN DateExpression := 010103D; DateFilter := '01.01.03..310103'; TempItemLedgEntry."Posting Date" := DateExpression; TempItemLedgEntry.INSERT; TempItemLedgEntry.SETCURRENTKEY("Document No.","Posting Date"); TempItemLedgEntry.SETFILTER("Posting Date",DateFilter); MESSAGE(FORMAT(NOT TempItemLedgEntry.ISEMPTY)); TempItemLedgEntry.Reset; TempItemLedgEntry.Deleteall; END; } CONTROLS { } CODE { VAR TempItemLedgEntry@1000 : TEMPORARY Record 32; DateFilter@1001 : Text[200]; DateExpression@1002 : Date; BEGIN END. } } Make sure that the record variable is defined as temporary…

One idea would be to use the virtual table Date amd different Filter Groups. Something like (Date is a variable of type Record, subtype Date): IsDateInsideFilter(DateFilter : Text[250];DateVar : Date) : Boolean Date.FILTERGROUP := 10; Date.SETRANGE("Period Type",Date."Period Type"::Date); Date.SETFILTER("Period Start",DateFilter); Date.FILTERGROUP := 0; Date.SETRANGE("Period Start",DateVar); EXIT(NOT Date.ISEMPTY); I hope you undertand what I mean, good luck!

Hi Beaver, You’re one minute faster… but don’t you prefer the solution with the Date table?

found it interesting … the one with the date table. but i need it for other types to … such as integers and texts. have made a codeunit now with the solution by beaver. thx.

Hi ahed4, And which tables did you use for the other data types?

well. i just made a temporary item ledger entry. for date i did: ile.reset; ile.deleteall; ile.“entry no.” := 1; ile.“posting date” := DateVal; ile.insert; ile.setfilter(“posting date”, filterval); exit(ile.find(’-’)); and for integer: ile.reset; ile.deleteall; ile.“entry no.” := IntVal; ile.insert; ile.setfilter(“Entry No.”, filterval); exit(ile.find(’-’)); and for texts: ile.reset; ile.deleteall; ile.“entry no.” := 1; ile.“Description” := txtVal; ile.insert; ile.setfilter(“Description”, filterval); exit(ile.find(’-’));

OK, good to know. [:)] Thanks for sharing.

Hi Nelson, your solution of course is good and clean! I like it. since ahed4 needs to check different types of vars, my dirty little solution is more flexible :wink: Working on a temptable with only one rec inserted, performance is just as good as working on the date table, I presume. Even if filtering on text fields.

OK, I’m happy that you like it! [:)]