select statement in view selection

烂漫一生 提交于 2019-12-24 11:36:31

问题


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.


回答1:


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")



回答2:


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...



来源:https://stackoverflow.com/questions/21748988/select-statement-in-view-selection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!