Passing filters from Record to RecordRef to Record

Hello everybody. I’m trying to dynamicly read filters from a record variable. Pass them to a recordref, then set the filters to a new record variable. My intentions are to be able to save filters and set them later on when needed. I have no problem to read and set new filters on a recordref, but I can’t pass these filters to record variable. I try to use the function RecordRef.SETTABLE(Rec). Here is my code: (The function Show is just there for debugging) **OnRun()** Cust.SETRANGE("Salesperson Code",'PS'); Cust.SETFILTER("No.",'..90000'); RecRef.GETTABLE(Cust); RecRef2.GETTABLE(Cust2); FOR i := 1 TO RecRef.FIELDCOUNT DO BEGIN FldRef := RecRef.FIELDINDEX(i); MyFilter := FldRef.GETFILTER; IF MyFilter <> '' THEN BEGIN //Show(FORMAT(FldRef.NUMBER) + ': ' + FORMAT(FldRef.NAME) + ' - Filter: ' + MyFilter); FldRef2 := RecRef2.FIELD(FldRef.NUMBER); FldRef2.SETFILTER(MyFilter); END; END; RecRef2.SETTABLE(Cust2); Show(Cust2.GETFILTERS); **Function Show(ShowText : Text[250]) : Boolean** EXIT(CONFIRM(ShowText,TRUE));

Hy Magnus what about: recref.copyfilters(recref2);… Bye (Stefan);

I cannot do copyfilters on a recordref.

quote:


recref.copyfilters(recref2);…


Anyway, I want to pass the filters from a recordref variable to a record variable. It would be nice to do Rec.COPYFILTERS(RecordRef); but that is not possible. If you look in the help on RecordRef.SETTABLE, it looks like the function I want, but it is not working.

I dont find any hits in my help for “SETTABLE” or Recordref’s Is is possible that this are functions of Navision-Clients > 3.01b? Bye (Stefan);

Hello Stefan

quote:


I dont find any hits in my help for “SETTABLE” or Recordref’s Is is possible that this are functions of Navision-Clients > 3.01b?


That is true. The datatype RecordRef is only available in version 3.60.

I have succeded. It’s always very easy when you know. Cust.SETRANGE("Salesperson Code",'PS'); Cust.SETFILTER("No.",'..90000'); RecRef.GETTABLE(Cust); // Here we can save the filters in the database and use them later // Then we can receive them at a later stage, apply them to av record variable // and show them in a report or form. Cust2.SETVIEW(RecRef.GETVIEW); Show(Cust2.GETFILTERS);