Here some quick info for how to apply a filter to a temporary record in a List Form: As we all know, for using a temporary record variable in a form some code needs to be added to the OnFindRecord() and OnNextRecord() functions. But when you try to set a filter using F7, Ctrl+F7 and so on, the system will not update the records shown. A very quick way to enable filters in temp forms is: put the following code to the OnAfterGetCurrRecord() trigger and be amazed: IF TempList.GETFILTERS() <> Rec.GETFILTERS() THEN TempList.COPYFILTERS(Rec); whereby TempList is the temporary record variable holding the records to be displayed. I hope that helps everybody who has this demand. Of course this can be changed as well to fit the needs for the “408 G/L Balance by Dimension” instead. In this case the code could look like: IF GETFILTERS() <> '' THEN BEGIN Case ColumnDimOption OF ColumnDimOption::"G/L Account": BEGIN IF (GETFILTER(Code) <> '') AND (GETFILTER(Code) <> GLAcc.GETFILTER("No.")) THEN GLAcc.SETFILTER("No.",GETFILTER(Code)); IF (GETFILTER(Name) <> '') AND (GETFILTER(Name) <> GLAcc.GETFILTER(Name)) THEN GLAcc.SETFILTER("Name",GETFILTER(Name)); END; ...
Always handy to know [:D] Maybe something for a tips and tricks forum?
Yeap, you are right, maybe one of the webmasters can just move it around ? Or should I post there again ?
It is not necessary to modify the OnAfterGetCurrRecord to allow the setting of filters, but you have to add the right code to OnFindRecord and OnNextRecord. If you look at the Navigate form (344) as a model of the code for OnFindRecord and OnNextRecord you will discover that the first line of each of these triggers assigns the form’s Rec variable to the temporary record variable (e.g. TempRec := Rec). If you use this then indeed setting filters will not work. If, however, you change this to a COPY (e.g. TempRec.COPY(Rec)) then setting filters will work just fine.
So all we need to know now is which option is faster in execution [:D]
Thanks for moving the topic !!! Whoever it was