在视图选择中选择语句 [英] select statement in view selection
问题描述
我只想选择满足以下条件的文档(我将语句放入视图属性的视图选择"中).我要实现的是以下逻辑:
如果用户具有[roleA]
SELECT(formA&status = 1)
如果用户具有[roleB]
SELECT(formA& status = 2)
如果用户具有[roleB]
SELECT(formA& status = 3)
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)
相反,SELECT出现在最前面,并且该语句不起作用或没有返回所需的结果.我尝试了以下语句:
选择@If(@IsMember("[roleA]"; @UserRoles);
(form ="formA"& status ="1"); 1 = 1)
这不会提供想要的结果.全部都托管在服务器上.
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.
推荐答案
您不能在视图选择中使用用户特定的功能.选择是在具有服务器凭据的服务器上完成的.
You can't use user specific functions in view select. The selection is done on server by server with server's credentials.
相反,创建三个视图-为每个角色创建一个单独的视图.然后根据大纲中的@UserRoles将用户链接到其"视图.
Create three views instead - for each role a separate. Link then user to "their" view depending on @UserRoles in an outline e.g.
另一种方法是在页面中使用嵌入式视图,如上一个问题所建议的.这次第一次分类列为status
,显示单个类别"将具有公式
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")
这篇关于在视图选择中选择语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!