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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
fashid
Specialist
Specialist

how to display a calculation result in text box without selections.

Hi,

I have an application which has section access on the branch names.

I have created an expression which gives the rank of the branch .

Say now when a user logs on . he has access to only a particular branch. so the text box should display that branch's rank.

But the problem i am facing is that ,the text box only displays the correct rank when the user makes a selection in the list box .

How do i get the text box to display the rank without the user making selection.

I am attaching the sample app that i am working on .

Regards,

Nadeem

Message was edited by: nadeem shaikh

1 Solution

Accepted Solutions
fashid
Specialist
Specialist
Author

Hi,

So what i did was, I created a trigger on open to select the value in the field and that did the trick for me .

Now the text box displays the desired result.

Regards,

Nadeem

View solution in original post

13 Replies
datanibbler
Champion
Champion

Hi nadeem,

sorry, I can't download your sample. It's too big and our connection is not too fast ... generally, though, when your textbox displays something only with a selection made, you can put that in a document-level trigger (> on open document < in the doc_properties dialog (Ctrl+Alt+D)

or

you can use a set_expression to sort of hard-code that selectionm. You would have to find a way of setting a variable depending on the branch the current user belongs to.

HTH

danieloberbilli
Specialist II
Specialist II

with section access its not possible to open your attached .qvw

fashid
Specialist
Specialist
Author

I have  disabled section access. you can open the document and have a look.

fashid
Specialist
Specialist
Author

Hi,

Could anybody put some light on this issue please

Regards,

Nadeem

datanibbler
Champion
Champion

Hi,

let's start from the beginning:

- You have SA in your app so any user can only access a specific part of the data, right?

- Is the app going to be run locally on the machines of the users? I assume it is, otherwise SA would not work.
  => Then you can use the OSUSER() function to find out exactly who is logged on.

HTH

(just come back once you have tried that)

fashid
Specialist
Specialist
Author

Ok So now i have created two triggers on opening the sheet which does the following

a)  Sets a variable for branch selection

=if(OSUser()='DOMAIN\nadeem','HYD')

b)select in field that particular variable value.

I am getting the desired result but the problem is that if the user has access to more than one branch.

How do i get to select two values in the field.

I really appreciate all your help .

Regards,

Nadeem

datanibbler
Champion
Champion

Hi,

well, if a user has access to two branches, you probably want to display the respective rank of both of them, right?

You can select several values in a field, but I'm not quite sure exactly how you have to write that in a trigger. You'll have to try out what works - comma, semicolon, the '|' - somehow it must be possible.

The issue is, you cannot display two different values in a textbox. Well, you can, but in every line, the textbox must have exactly and only one value to display, otherwise it won't work. So you'll need a specific textbox in that case, you cannot use the same one.

Maybe another approach is easier in that respect: You have somewhere the information which user shall have access to which branch, right? Can you put that in a table?

=> Then you could the necessary part of that table (depending on the logged_on user that you can query in the script)
      into QlikView and create row_numbers (always 1 for those users who can access only one, 1 and 2 for those who
      can access 2 ...)

=> Then you can use those numbers in a set_expression in your textbox => so the textbox would have two lines, but
     usually only one would be used, with the set_expression (usually unnecessarily, but never mind) fixing that number
     (the value in that field) to the nr. 1 - that will suffice for the users who have access to only one branch.

=> In the second line, there would be the same set_expression, only fixing the value in that field to the nr. 2 - that will then not display anything for the users who can access only one branch, but for those who can access two, it will display the rank of the second branch.

HTH

fashid
Specialist
Specialist
Author

Hi,

I do not have a problem if the text box does not display both the ranks simultaneously.

Even if both the branches are selected the text box should not display any result, which is the default behavior as of now.

The only problem i am facing is in selecting both the values in the Branch list box

Regards,

Nadeem

jonathandienst
Partner - Champion III
Partner - Champion III

If you want to see the ranks wrt all branches, but limit the branches based on SA, you could calculate the rankings in the load script and save that in a derived field that uses a duplicate of the branch field that is not limited by SA.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein