Options

Onlookup on Form

gulamdastagirgulamdastagir Member Posts: 411
Iam trying to filter all but one location HO on a Transfer Order form when i click the Onlookup button next to the "Transfer -To Code" TextBox.

Iam having problem with the following code:
TH(record variable of subtype transfer header)

TH.RESET;
TH.SETCURRENTKEY("Retail Status","Transfer-to Code");
TH.SETFILTER("Transfer-to Code",'<>HO');

IF FORM.RUNMODAL(5740,TH) = ACTION::LookupOK THEN BEGIN
Text:=TH."Transfer-to Code";
EXIT(TRUE);
END

ELSE
EXIT(FALSE);
Regards,

GD

Comments

  • Options
    krikikriki Member, Moderator Posts: 9,090
    And what exactly is your problem?
    The code looks right.

    One remark though:
    FORM.RUNMODAL(5740,TH)
    
    Better use:
    FORM.RUNMODAL(FORM::"Name of the Form",TH)
    
    The same goes also for other objects.
    This code is better for later upgrading and when searching where some object is used.[/url]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    gulamdastagirgulamdastagir Member Posts: 411
    What if i want to filter on ALL Except N locations what would be the syntax for the SETFILTER?
    Regards,

    GD
  • Options
    gulamdastagirgulamdastagir Member Posts: 411
    This works as it filters ALL except two locations.


    TH.SETFILTER(Code,'<>%1&<> %2','HO','XYZ');
    Regards,

    GD
  • Options
    krikikriki Member, Moderator Posts: 9,090
    This works as it filters ALL except two locations.


    TH.SETFILTER(Code,'<>%1&<> %2','HO','XYZ');
    This is a way to do it.
    Another way would be:
    FOR intInteger := 1 TO (number of locations you don't want) DO BEGIN
      TH.FILTERGROUP(5 + intInteger); // =starting with filtergroup 6
      TH.SETFILTER(Code,'<>%1',codLocation[intInteger]);[/quote]
      TH.FILTERGROUP(0);
    END;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.