I need to filter "Transfer from code and transfer to code" for transfer order page
by two location fileds(service and sales filter in user management) not respectively. It should apply for both.
For first setfilter function its working.
SETFILTER("Transfer-to Code",'%1|%2',UserSetupMgt.GetServiceFilter,UserSetupMgt.GetSalesFilter);
but if i add the following code no data displays.
SETFILTER("Transfer-from Code",'%1|%2',UserSetupMgt.GetServiceFilter,UserSetupMgt.GetSalesFilter);
Is there any way to filter two fields with two different data at same time?
Thanks in Advance.
*This post is locked for comments
Thanks for your help in the code
Thanks Ghetz for your idea Its working...
Hi Anandb313,
I agree with Ghetz suggestion, mark and show needed records:
Rec.RESET;
IF Rec.FINDSET THEN
REPEAT
IF (Rec."Transfer-to Code"= UserSetupMgt.GetServiceFilter) OR (Rec."Transfer-to Code"= UserSetupMgt.GetSalesFilter)
OR (Rec."Transfer-from Code"= UserSetupMgt.GetServiceFilter) OR (Rec."Transfer-from Code"= UserSetupMgt.GetSalesFilter) THEN
Rec.MARK(TRUE);
UNTIL (Rec.NEXT = 0);
Rec.MARKEDONLY(TRUE);
Hi Anandb313,
I agree with Ghetz suggestion, mark and show needed records:
Rec.RESET;
IF Rec.FINDSET THEN
REPEAT
IF (Rec."Transfer-to Code"= UserSetupMgt.GetServiceFilter) OR (Rec."Transfer-to Code"= UserSetupMgt.GetSalesFilter)
OR (Rec."Transfer-from Code"= UserSetupMgt.GetServiceFilter) OR (Rec."Transfer-from Code"= UserSetupMgt.GetSalesFilter) THEN
Rec.MARK(TRUE);
UNTIL (Rec.NEXT = 0);
Rec.MARKEDONLY(TRUE);
When you apply the filters on the fields it will apply the AND operation, if you want to do as OR operation then you need to do in two separate operations first apply the first filter retrieve and do your logic and then clear the filter and apply the second filter on another field and then do your logic.
Please check this post: [View:https://community.dynamics.com/nav/f/34/t/268256:750:50]
You can't do it directly, but there are workarounds. The downside is you need to loop through all the records. This is the answer I implemented:
IF Rec.FINDFIRST THEN REPEAT IF (Rec.OutAgent = 'Bryan') OR (Rec.InAgent = 'Bryan') THEN Rec.MARK(TRUE); UNTIL Rec.NEXT = 0; Rec.MARKEDONLY(TRUE);
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,902 Super User 2024 Season 2
Martin Dráb 229,336 Most Valuable Professional
nmaenpaa 101,156