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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
phil-ebm
Creator
Creator

document trigger "onOpen" set Field with if-else

Hi All

I have a Problem. I want to use the onOpen-Trigger to set a value in a field.

openTrigger.png

According to the select language i have to set different fields.

I want to reslove this problem with a if/else statement like this.

ifelse.png

No the Problem is, it doesn't work.

I've tried it with "=" and without one. But it was the same result 😕

Can someone help?

8 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Try this:

[$(=If(%LANG......._EN]))]

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
alexandros17
Partner - Champion III
Partner - Champion III

The problem is in %LANG, it is a field but which value is used in the opening moment?

If you select the field with a value use the getfield selection ...

Let me know

phil-ebm
Creator
Creator
Author

Hi guys

thanks for your answers, but it is still not working.

with the value i habe no problem but with the field.

When i write only one Field without the if-statement it works but when i add the second field in the if-statement there is no reaction when I open the document.

kristoferahlin
Partner - Contributor III
Partner - Contributor III

Add '=' first in the Field expression?

Also, are you sure %LANG has either DE or EN selected when the app is opened?

Regards,

Kristofer

phil-ebm
Creator
Creator
Author

no

yes i'm sure that DE or EN is selected onopen because i set DE as default.

kristoferahlin
Partner - Contributor III
Partner - Contributor III

One alternative might be to define a variable depending on the value in %LANG and use that variable in field expression?

set vLang = =if(%LANG = 'DE', 'Q-Gate-Typ_DE', 'Q-Gate-Typ_EN')

Then put =$(vLang) as Field expression?

How do you select a value in %LANG?

Selecting a value in %LANG and setting the Q-Gate-Typ_ fields at the same time as "on document open" tiggers migth be problematic...

jonathandienst
Partner - Champion III
Partner - Champion III

I think the [] brackets inside the expression may be the problem. Try it without:

=[$(=if(%LANG = 'DE', 'Q-Gate-Typ_DE', 'Q-Gate-Typ_EN'))]

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

If your Users will be accessing it via the Accesspoint using the Ajax client, then do test a simple OnOpen Trigger in WebView mode or Ajax via the Accesspoint first to avoid disappointment later.