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.
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!
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.
Answers
E.g. for filtering on flowfields: Select all items with an inventory
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Please help to solve the below line of filtration..
RecVar.SETFILTER("User ID",'%1','USERID'); //"User ID" is FlowField
Other then that rest of the stuff will be same.
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.
Rehan Satti
Microsoft Dynamics NAV Technical Consultant
Please verify the answer if it satisfy your question. This will help other members of community.
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.
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.