Dears,
I'm trying to find a documentation for Filter Expression, Please give me a link for any document contains more details than Admin guide.
Thanks in advance.
Dears,
I'm trying to find a documentation for Filter Expression, Please give me a link for any document contains more details than Admin guide.
Thanks in advance.
Hello Maged,
We have two resources for filter expressions. The first is the "Filter Expression Syntax and Examples" page in the Laserfiche Administration Guide help files. More information about filter expression syntax can be found in the developer notes, which are kept on the Support Site.
One thing I would like to mention is that folder filter expressions, even very simple ones, have a very negative impact on performance. If at all possible, ACLs and security tags should be used to enforce access controls and folder filter expressions should be considered a last resort.
Will filter expressions support tokens. For example, if I have a field named "Access_Username" (multivalue) and want the login user to be able to access documents with that field filled in with his/her username, what would the expression be??? The Admin help files aren't very informative on the use of token's in the expressions. If they do support them, what is the syntax? I am using:
(IS_GROUP_MEMBER('Habeas Defense Attorney') = 1) AND ANY entryprop."Access_Username" = 'username'
The token for 'username' doesn't seem to work, nor does the "ANY" operator. With "ANY" it in the string, the expression isn't accepted into the properties field.
I'm not sure how to answer your question about tokens. As the admin guide shows but does not call particular attention to in a couple of its examples, you can use
CONTEXT('username')
to stand in for the name of the current user.
As for "ANY", if I'm reading the dev notes correctly, it can only be applied to an expression on the right-hand side of a relational operator, so you'll have to construct your field-matching clause like so:
CONTEXT('username') = ANY entryprop."Access_Username"
For the expression, I am using
"(IS_GROUP_MEMBER('Habeas Defense Attorney') = 1) ANY .entryprop."Access_Username" = 'username'
so that if that user is in the group "habeas Defense Attorney" and the user's name is in the template field called "Access_Username", which is a multivalue field, it should work. But when I try to save I get the message: " Invalid filter expression: missing characters or bad format. If I use a "AND" instead of "ANY", it takes it but doesn't allow the user access.
By the way, I get the same message if I use "AND ANY" like it says in the admin guide, even when I don't use a group, just a user.
(context ('username') = 'test' AND ANY entryprop."Access_username
" = 'username')
The example in the admin guide is incorrect. It should instead be
(context ('username') = 'UserName' AND 'FieldValue' = ANY entryprop."FieldName")
I've requested that this be fixed.
In your case, it looks like you want
(IS_GROUP_MEMBER('Habeas Defense Attorney') = 1) AND context('username') = ANY entryprop."Access_Username"
which should check for membership in the 'Habeas Defense Attorney' group and also check whether any value in the "Access_Username" field matches the name of the currently logged-in user.
That did it. Thanks for your help.