Reputation: 159
I want to select only the documents that fulfill the following conditions (I put the statement into "View Selection" of the view's property). What I want to achieve is the following logic:
If user has [roleA]
SELECT(formA & status=1)
if user has [roleB]
SELECT(formA & status = 2)
if user has [roleB]
SELECT(formA & status = 3)
Instead SELECT gets appened to the front and the statement does not work or does not give back the desired results.I have tried the following statement:
SELECT @If(@IsMember("[roleA]"; @UserRoles);
(form = "formA" & status="1"); 1=1)
this does not provide wanted results. All is hosted on a server.
Upvotes: 1
Views: 1707
Reputation: 12060
Using "dynamic" selection statements most often is a bad idea. Therefor it doesn't matter, if you use a SPOFU- View (Shared, Private on first use) or single category.
Each of the solutions has different disadvantages. If the number of roles is finite and does not change that often, I would suggest to create one view for each role with the right selection formula.
Then you use an Outline, and in this outline you simply compute the title and which view to show for each user with the appropriate formula.
That way, the user can do anything in the view: Search, sort, filter, etc. and does not have any restrictions...
Upvotes: 3
Reputation: 30960
You can't use user specific functions in view select. The selection is done on server by server with server's credentials.
Create three views instead - for each role a separate. Link then user to "their" view depending on @UserRoles in an outline e.g.
Another way is using an embedded view in a Page like suggested in your last question. This time first categorized column would be status
and "Show single category" would have formula
@If(@IsMember("[roleA]"; @UserRoles); "1"; @IsMember("[roleB]"; @UserRoles); "2"; "3")
Upvotes: 5