Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How can we hide some tabs depending on the possible values of a field?

We have the variable vNotAllowCompanies =  1, 5, 8, 12 (in a future it is possible that change the number of companies  here), so when a user has in the possible values of the CompanyID Field only values of companies that are in the vNotAllowCompanies the Main tab will be hidden.

Let me explain with two examples:

User 1 has visibility to the companies 1, 5, 18 and 27 therefore he has to see all tabs, however when he do selections and the possible values for the CompanyID field are 1 or 5 or (1 and 5) the Main tab will be hidden.

User 2 has only visibility to the companies 1, 5, therefore the Main tab will be hidden when he access to the dashboard.

Could you please help us with this issue?

Thanks in advance.

15 Replies
Anonymous
Not applicable
Author

Correct, the 'not allowed' values could change from day to day  (IE: with every refresh). That is why we need to do this in a flexible way.

JonnyPoole
Former Employee
Former Employee

Okay .

So i eliminated variables all together and loaded the 'not allowed' list from a data source and then created a delimitted list in a variable. The list in the variable could update with every refresh.

The magic condition to check for whether the user has selected sheets that are the same or a subset of the list is as follows where every row/sheet value is check in the not allowed list and if its NOT found, it means there are some allowed sheets in the selection. Only when all of the sheets in the selection are found in the list would it hide

=len(concat ( distinct  if( substringcount( vNotAllowedList, Sheet) = 0, Sheet), ',')) =0

Anonymous
Not applicable
Author

Hi @Jonathan, it works perfectly!! Thank you!!

I was able to understand the expresion however I have a bit of a doubt. Why is the objective of "len = 0" in the expresion?

JonnyPoole
Former Employee
Former Employee

To explain lets break it down


substringcount( vNotAllowedList, Sheet) = 0 , will check each 'Sheet' value in the possible range (white/green values) in the user's selection to see if any are in the do not allowed list.  If a value is NOT in the 'do not allowed'  list, then include the value or else do not.


The concat( distinct )  will , from the list of values resolved by the above, create a comma delimitted list of all the values in the user's  current selection that are  NOT  in the 'do not allowed' list.  


If the list has at least one value , then the user has at least one value that is NOT in the 'do not allowed' list , and in that situation the  length (len()) of this list is > 0  ... which means to show the main sheet.  If the user does not have any values in their selection that are NOT in the 'do not allowed' list, then the list will be empty and  ALL of the values are in the do not allowed list (this key condition we are looking for) and the sheet should be hidden.



Anonymous
Not applicable
Author

@Jonathan, Thank you very much for the explanation!

JonnyPoole
Former Employee
Former Employee

Excellent. Have not see the requirement before but glad it worked out.

In case someone else runs into this requirement,  kindly mark correct answers so that others can find the solution that ended up working too..