SETFILTER on LookupForm as var

Hello; I am attempting to set a filter on a lookup form that is invoked with a variable. CLEAR(TheLookupForm); ==> TheLookupForm.SETFILTER(“Field of Interest”, ‘’); TheLookupForm.LOOKUPMODE(TRUE); IF TheLookupForm.RUNMODAL = ACTION::LookupOK THEN BEGIN … END; The line with the ‘==>’ in it causes the compiler to interpret SETFILTER as an undeclared global. How apply the filter to the form? Brian.

You could try the following instead: CLEAR(TheLookupForm); setfilter(“Field of Interest”, ‘’); TheLookUpForm.SETTABLEVIEW(Rec); //Assuming Field of interest is in the table in use IF TheLookupForm.RUNMODAL = Action::LookupOK THEN BEGIN … END Edited by - robin on 2001 Mar 26 18:25:37

RE: TheLookUpForm.SETTABLEVIEW(Rec); //Assuming Field of interest is in the table in use As it turns out, the tableview is not found in a table in use. However, there is a global record var that would serve the same purpose. I think this should work, but it doesn’t. OtherRecordVar.SETFILTER(“Field of Interest”, ‘expr’); TheLookUpForm.SETTABLEVIEW(OtherRecordVar); Brian.

My apologies … Your SETTABLEVIEW suggestion did work. I had some old code in there causing things to misbehave. Brian.

uups! You cannot use SETFILTER on a Form, only on a record! So let’s go step by step: Every Form has a record. So use this record to set the filters. Example: MyForm uses MyRecord.


Var:
  MyRecord : Record 50000;
  
Begin
  MyRecord.Reset;
  MyRecord.SetFilter("No.",'ABC');
  If Form.RunModal(Form::"MyForm",MyRecord) = ACITON::LookupOk then Begin
    ...
  End;
END;

------- With best regards from Switzerland Marcus Fabian