Hello everyone, I hope someone will be able to help me with my small problem.
I have a setup table for all user, where I can mark user as a Requestor and Approver. I also have a table with fields Approver and Requestor filled with proper ID of user. Table has its own card form.
I try to filter all records shown by my form using FILTERGROUP(2) and SETFILTER (or SETRANGE, does not make any difference) - depending on user is logged in and using the form. And for example when user opens the form and in setup table he is marked as Requestor - he can see only records with his ID in field Requestor. When he is marked as Approver - he can see only records with his ID in Approver field. But there is a problem - when user is marked as Requestor AND ALSO as a Approver, I do on my form :
SETFILTER("Approver", USERID);
SETFILTER("Requestor", USERID);
but this makes the user to see only records where he is an Approver AND ALSO a Requestor. I need to see records where he is an Approver OR Requestor.
How can I make some kind of OR in SETFILTER (SETRANGE) functions for two fields?
This problem is really annoying to me, sorry for my english.
Thx in advance.
0
Comments
I understand that by that I can mark actual record (or not mark it - depends on what I need to check), but how can I use it? Maybe there something that I am missing? Maybe I can somehow 'skip' a record when I check that it not should be seen by current user?
There is no option to filter with or.
So filter the records on approver = userid, then iterate over them and mark them. remove the filter of approver (or for a faster result altough small table I doubt it will be noticable set the filter of approver <> userid, set the filter on requestor, en mark those results.
After that remove the filter again and set markedonly on that recordset.
Only the marked records will be visible.
|To-Increase|
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
setfilter(approver,userid);
if usersetup.Requestor then
setfilter(Requestor,userid);
then ur filtergroup