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.

1 Solution

Accepted Solutions
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

View solution in original post

15 Replies
Not applicable
Author

Can you post a sample application here?

JonnyPoole
Former Employee
Former Employee

In this sample, the values that when only both or only one is selected cause the main sheet to hide are reflected in 2 different variables. The values are in numeric order. So if the values were 8 and 25, then vNotAllowed1=8 and vNotAllowed2=25.

The hide/show condition for the sheet is as follows:

=if(GetSelectedCount(Sheet) > 0 and  (  SubStringCount(  vNotAllowed1 & '-' & vNotAllowed2 , Concat( DISTINCT Sheet , '-', Sheet))>0) , 0,1)

to hide the sheet:

A)  A user selection MUST be made on the Sheet field

B)  A delimitted list of 'possible' Sheet values (white or green) in numeric assorting order represents a subset of  a delimitted list of the 2 variable values.

So if i select sheet 1 and 2 ->   1-2  is found within 1-2 -> HIDE

So if i select sheet 1    1  is found within 1-2 -> HIDE

So if i select sheet 3    3  is NOT found within 1-2 -> SHOW

If i select no sheet value  no value has been selected -> SHOW

Would that work for the first case?

Capture.PNG.png

Anonymous
Not applicable
Author

Hi,

@Jonathan Poole, thanks for your answer.

It seems that it is not working fine with more than 2 values. I just added a third value not allowed (vNotAllowed3) and if I select the values sheet1 and sheet3 it is not working fine.

I am attaching you a new version of the sample application.

Do you please have any advice?

Thank you

vikasmahajan

I Think you need to implement section access Please find attached file

user      admin    

password admin1

Hope this helps you

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Anonymous
Not applicable
Author

Hi Vikas, I am not able to see the attached file. In any case in the attached example in my post the user would have visibility to Sheet 1, 2, 3,4 and 5, therefore it is not seems to be implemented with section access\application. However when only are selected (or possible values) the values of vNotAllowed1, 2 and 3 in the Sheet field some tabs have to be hidden.

JonnyPoole
Former Employee
Former Employee

That would make sense. I need to amend the sample for greater than 2 possibilities and repost.  Stay tuned!

JonnyPoole
Former Employee
Former Employee

Here is an updated version. The condition now check if the possible Sheet values (white/green) within the user's selections represent the equivalent (or a subset) of the same possible values that match up with the list of values stored amongst the variables.

---------------------------

=if(

(   SubStringCount(  Concat( DISTINCT Sheet , '-', Sheet), vNotAllowed1)

  +

  SubStringCount(  Concat( DISTINCT Sheet , '-', Sheet), vNotAllowed2)

  +

  SubStringCount(  Concat( DISTINCT Sheet , '-', Sheet), vNotAllowed3)

>=

GetPossibleCount(Sheet) 

)

, 0,1)

Anonymous
Not applicable
Author

Yes, it is working now, however in a future we will have more not allowe values, so what about if in some days we have 4 not allowed codes. I think in this case we would have to modify the formula to add that restriction .

=if(

(   SubStringCount(  Concat( DISTINCT Sheet , '-', Sheet), vNotAllowed1)

  +

  SubStringCount(  Concat( DISTINCT Sheet , '-', Sheet), vNotAllowed2)

  +

  SubStringCount(  Concat( DISTINCT Sheet , '-', Sheet), vNotAllowed3)

  +

  SubStringCount(  Concat( DISTINCT Sheet , '-', Sheet), vNotAllowed4)

>=

GetPossibleCount(Sheet)

)

, 0,1)

Do you know how can we do it without have to update the formula?

Thanks in advance.

JonnyPoole
Former Employee
Former Employee

That is true.  Could the 'not allowed' values change from day to day  (IE: with every refresh) ?  Or would the exact change be known in advance , infrequent, and therefore  handled through a 'managed update' of the app by altering the expression, variable list etc... ?

I think the whole thing could be done dynamic if it changed unexpectedly each day.  Probably not too difficult, may need some more advanced code. Not sure.

let me know.