Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Author

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

View solution in original post

7 Replies
marcus_sommer

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
Author

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.

marcus_sommer

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

- Marcus

Not applicable
Author

What would be result when Field be OMITed for User B

count(unavailable Field)=?

marcus_sommer

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
Author

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
Author

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