Filtering in Journals

FarayiFarayi Member Posts: 11
1) I have created a boolean field in Fixed Asset Table called Hog (Yes/ No).

I would like to Filter for Fixed Assets with Hog::Yes in the Fixed Asset Journal.

I put this code in the OnLookup Event for FA No. field in Fixed Asset Journal Form : e.g.

fixedAsset.setfilter(Hog,'Yes');

Its not working - please help.

Farayi

:-k
Africa

Comments

  • ara3nara3n Member Posts: 9,255
    you need to go to tablerelationship property of the field and add filter in there.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • FarayiFarayi Member Posts: 11
    Thanks Man! I still a problem:

    If I go the Table Relationship propertyv of the field - it means that the filter will be there permanently - only only want it for a particular journal and not filter on other journals
    Africa
  • krikikriki Member, Moderator Posts: 9,086
    Table Relationship property : just leave the relationship like it was
    and put the following code in the "OnLookup"-trigger of the field in the table (so it will work on all forms on this table)
    recFixedAsset.RESET;
    recFixedAsset.SETCURRENTKEY("No.");
    IF (I have to filter-condition) THEN
      recFixedAsset.SETRANGE(HOG,TRUE);
    recFixedAsset."No." := "FA No."; // for positioning on last selected value
    IF FORM.RUNMODAL(0,recFixedAsset) = ACTION::LOOKUPOK THEN BEGIN
      VALIDATE("FA No.",recFixedAsset."No.");
    END;
    

    In case you only want it on 1 form, put this code on the "OnLookup"-trigger of the field in the form:
    recFixedAsset.RESET;
    recFixedAsset.SETCURRENTKEY("No.");
    IF (I have to filter-condition) THEN
      recFixedAsset.SETRANGE(HOG,TRUE);
    recFixedAsset."No." := "FA No."; // for positioning on last selected value
    IF FORM.RUNMODAL(0,recFixedAsset) = ACTION::LOOKUPOK THEN BEGIN
      Text := recFixedAsset."No.";
      EXIT(TRUE);
    END;
    EXIT(FALSE);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • FarayiFarayi Member Posts: 11
    Thanks Alain Krikilion

    Your Brilliant suggestion sort my problem and clarifies a lot. Now I can move on.


    Best regards,


    Faraiy :D
    Africa
Sign In or Register to comment.