Qlik Community

QlikView Security & Governance

Discussion Board for collaboration on QlikView Security and Governance.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

Hi Guys,

Expression Count( {<$Field={aFieldName}>} $Field) is returning 1 in all condition after publish the document to server. Why?

This expression I am using to Hide List box when Field used in it is OMITed for few users.

Same is working correctly on Client Machine..

https://community.qlik.com/thread/163197

1 Solution

Accepted Solutions
Not applicable

Re: Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

Hi All,

Here is the solution for hiding a listbox if field used under it is getting OMITed for few users.


I kept this expression in Listbox Properties-->Layout-->Show-->Conditional-->isnull(FieldValue('Your Field name',1))=0

It is working as expected. 


To explain how this works:

  • The FieldValue function looks at the Symbol table for the field in the first parameter (note that the field name is in single quotes), for the entry in the symbol table in the position of the second parameter
  • If this function does not find a value in the symbol table, it will return a NULL
  • So this expression looks in the symbol table – if there are no values available to the logged on user this will return a NULL.  We wrap this inner function with an isull() function and check if it returns zero
  • If the logged on user has access to the nominated field the complete expression will return -1, so the object will be shown, but if the logged on user does not have access to the field the complete expression will return zero and the object will be hidden
7 Replies

Re: Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

I assume that your section access don't worked as you expected it on the server. You will login with a different user and there are some section access differences between server and desctop, too: Section Access: Desktop vs Server

- Marcus

Not applicable

Re: Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

Section access working as expected and It is OMITTING the column Which I want to Omit but Only this expression not changing.

I checked by doing this.

On a new Sheet add the column (Omit Column) and also expression Count( {<$Field={aFieldName}>} $Field).

When I publish my app to server and log in with 2 different users A and B where A should see the column and B should not see the column.

In App, For user A I am seeing Column and Expression value 1 and for user B I am not able to see column (unavailable) and its values but still expression is having value 1.

Re: Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

Wouldn't be a simple expression like count(FieldName) enough for such a visibility-condition?

- Marcus

Not applicable

Re: Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

What would be result when Field be OMITed for User B

count(unavailable Field)=?

Re: Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

I haven't tested it yet. But you need only one value for the condition and therefore something like if(count(FieldName)>=1, true()) should work. Maybe a getpossiblecount() could be an alternatively.

- Marcus

Not applicable

Re: Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

Hello Everyone,

Could you please trying publishing this document and see Salary List box is hiding or not.

I am attaching sample QVW and Data in Excel.

Just add your Domain and User Name in Excel and then Uncomment Section access in QVW and reload save and publish

I have added Expression Count( {<$Field={[Salary]}>} $Field)>=1 for Salary List box on Sheet 1 and SubStringCount(Concat([$Field], '|'), 'Salary')>=1 for Salary List box on Sheet 2 but none of them are working after publish to server.

On Desktop It is working.

Not applicable

Re: Expression Count( {<$Field={aFieldName}>} $Field)=1 always giving result 1 after publish

Hi All,

Here is the solution for hiding a listbox if field used under it is getting OMITed for few users.


I kept this expression in Listbox Properties-->Layout-->Show-->Conditional-->isnull(FieldValue('Your Field name',1))=0

It is working as expected. 


To explain how this works:

  • The FieldValue function looks at the Symbol table for the field in the first parameter (note that the field name is in single quotes), for the entry in the symbol table in the position of the second parameter
  • If this function does not find a value in the symbol table, it will return a NULL
  • So this expression looks in the symbol table – if there are no values available to the logged on user this will return a NULL.  We wrap this inner function with an isull() function and check if it returns zero
  • If the logged on user has access to the nominated field the complete expression will return -1, so the object will be shown, but if the logged on user does not have access to the field the complete expression will return zero and the object will be hidden
Community Browser