Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

phil-ebm
Contributor

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
MVP
MVP

Re: document trigger "onOpen" set Field with if-else

Hi

Try this:

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

HTH

Jonathan

Re: document trigger "onOpen" set Field with if-else

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
Contributor

Re: document trigger "onOpen" set Field with if-else

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
New Contributor III

Re: document trigger "onOpen" set Field with if-else

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
Contributor

Re: document trigger "onOpen" set Field with if-else

no

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

kristoferahlin
New Contributor III

Re: document trigger "onOpen" set Field with if-else

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...

MVP
MVP

Re: document trigger "onOpen" set Field with if-else

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'))]

Re: document trigger "onOpen" set Field with if-else

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.