Filter flowfield

zac
zac Member Posts: 29
Hi folks,
when I would like to filter a flowfield, do I use SETFILTER or SETRANGE?
For example, I would like to get a value from the Field1 depending to the Filed2 which is the flowfiled.

Answers

  • i4tost
    i4tost Member Posts: 208
    same as for any other field. Both are valid :)
  • jversusj
    jversusj Member Posts: 489
    just be sure you do a CALCFIELD first or you won't have a value to filter! :)
    kind of fell into this...
  • zac
    zac Member Posts: 29
    Tnx guys!
  • kriki
    kriki Member, Moderator Posts: 9,121
    jversusj wrote:
    just be sure you do a CALCFIELD first or you won't have a value to filter! :)
    This is not correct. The CALCFIELDS serves to calculate the value of flowfields in the CURRENT record. It does not serve for filtering.
    E.g. for filtering on flowfields: Select all items with an inventory
    recItem.RESET;
    recItem.SETCURRENTKEY("No.");
    recItem.SETFILTER(Inventory,'>0'); // Inventory is a flowfield
    IF recItem.FINDSET THEN
      REPEAT
        // Now you have a record with inventory > 0
        MESSAGE('Item "%1" has a positive inventory',recItem."No.");
    
        // if you want to know the value of recItem.inventory, you need to do a CALCFIELDS
        recItem.CALCFIELDS(Inventory);
        MESSAGE('Item "%1" has an inventory of %2 ',recItem."No.",recItem.Inventory);
      UNTIL recItem.NEXT = 0;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • navuser1
    navuser1 Member Posts: 1,334
    hi Kriki,

    Please help to solve the below line of filtration..

    RecVar.SETFILTER("User ID",'%1','USERID'); //"User ID" is FlowField
    Now or Never
  • zohaibu95@hotmail.com
    zohaibu95@hotmail.com Member Posts: 223
    Before using SETFILTER make sure to use CALCFIELDS("YOUR FLOW FIELD");
    Other then that rest of the stuff will be same.
    Best Regards
    Zohaib Ahmed
    Dynamics NAV ERP Technical Consultant.

    please like / agree / verify my answer, if it was helpful for you. thanks.
  • rehansatti
    rehansatti Member Posts: 36
    It is always a good habit to user CLEAR before applying any filter. You always knows what filter are applied.
    Best Regards
    Rehan Satti
    Microsoft Dynamics NAV Technical Consultant
    Please verify the answer if it satisfy your question. This will help other members of community.
  • Kishorm
    Kishorm Member Posts: 921
    zohaibu95 wrote: »
    Before using SETFILTER make sure to use CALCFIELDS("YOUR FLOW FIELD");
    Other then that rest of the stuff will be same.

    As @kriki has already stated above - you do not need to do a CALCFIELDS prior to setting a filter on a Flow Field
  • zohaibu95@hotmail.com
    zohaibu95@hotmail.com Member Posts: 223
    Kishorm wrote: »
    zohaibu95 wrote: »
    Before using SETFILTER make sure to use CALCFIELDS("YOUR FLOW FIELD");
    Other then that rest of the stuff will be same.

    As @kriki has already stated above - you do not need to do a CALCFIELDS prior to setting a filter on a Flow Field

    Oh okay thanks. :)
    Best Regards
    Zohaib Ahmed
    Dynamics NAV ERP Technical Consultant.

    please like / agree / verify my answer, if it was helpful for you. thanks.