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: 
Anonymous
Not applicable

Could this be a bug with Trigger Actions?

When a user opens a document I have a document OnOpen trigger that compares the OS User opening the file to a list of usernames in a loaded table. If the username is found a variable called vDevUser gets set to 'true'. This variable is then used to control which sheets and objects are visible to the user.

This works fine when the actions are attached to a button but this doesn't work in the document OnOpen trigger. I'm wondering if this might be a bug?

Existing variable in document:  vUser = purgechar(osuser(),'NA\')

Action 1:  'Select in Field' where field AD_Username equals variable vUser.

Action 2:  'Set Variable' vDevUser equals =If(GetSelectedCount(AD_Username)>0,'true','false')

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think it's more a problem of using 1 trigger for two actions that are dependent from one another.

If you clear the selection in field AD_Username and the variable vDevUser, do you get your expected result at the very first button click or do you need to click twice?

You can try replacing your two actions with 1 action:

'Set Variable' vDevUser equals

=count(if (USER =$(=purgechar(osuser(),'NA\')), USER))

View solution in original post

5 Replies
swuehl
MVP
MVP

I think it's more a problem of using 1 trigger for two actions that are dependent from one another.

If you clear the selection in field AD_Username and the variable vDevUser, do you get your expected result at the very first button click or do you need to click twice?

You can try replacing your two actions with 1 action:

'Set Variable' vDevUser equals

=count(if (USER =$(=purgechar(osuser(),'NA\')), USER))

marcus_sommer

With Ajax an OnOpen trigger don't work. If yes, you should replace the trigger - perhaps per variable.

- Marcus

Anonymous
Not applicable
Author

No, I'm using the IE plugin. But the Ajax point is a good one considering the IE plugin is going away in version 12. Anyone know if Actions will be supported in QV 12?

Anonymous
Not applicable
Author

Thanks swuehl. You got me on the right track. The final OnOpen trigger was a single action:

Set Variable "vDevUser" =

=If(Count({$<AD_Username = {$(=purgechar(osuser(),'NA\'))}>}AD_Username)>0,'true','false')

Anonymous
Not applicable
Author

BTW, this works in the Ajax client as well.

For anyone interested, here is the purpose for this:

Our standard QV application template contains sheets and objects that we only want visible to our QV developers. Instead of hard-coding developer usernames into the script, we create a QVD file each morning that contains all the users from an Active Directory group which contains everyone who is a QlikView developer in our company. This allows the logic to be dynamic whenever developers come and go in the company (assuming the Active Directory group is updated if course). When the QV application is opened in either Desktop or AccessPoint, the OnOpen trigger checks to see if the current user's username is in the developers table. If it is, a variable (vDevUser) gets set to 'true'. All of the sheets and objects that are for developer eyes only have a show condition of vDevUser=true.