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: 
edwin
Master II
Master II

$expansion inside an expression with alternating states

Hi,

i have a language field and altenating states.  ive set the alternate state of the object to use STATE1 for example and have the following measure:

=concat(distinct Mesure,'|',metric_sort_order_$(=only(language_code))) & '|'

for STATE1, i selected the lang_code = fr, but for default state  lang_code=en

notice the embedded $expression.  what i am observing is that the $expression is evaluated using the default state (en) even if the object were set to use the state STATE1. so this evaluates to

=concat(distinct Mesure,'|',metric_sort_order_en) & '|' - which is for default state

when i wanted it to be 

=concat(distinct Mesure,'|',metric_sort_order_fr) & '|'  - that is for STATE1

if i take this out and add the measure

=only(language_code)

it properly evaluates to the correct value for the state (fr)

 

i do understand that i can add {STATE1} in the expression.  but for my purpose, i wanted it to inherit the state of the object.  

anyone with thoughts on whats going on?  the doc says:

 

edwin_0-1647905167755.png

thanks

edwin

Labels (1)
2 Solutions

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I do not see the same behavior as you.  In my similar test the $() expression is evaluated in the state of the containing object.  What version are you using and can you upload a small example that demonstrates the problem?

-Rob

View solution in original post

Digvijay_Singh

My test as well evaluates in the state of the containing object but I see wrong conversion in the expression editor, my expression evaluates for 'fr' but expression editor shows 'en', but I have seen such conversion bugs in the expression editor bottom section in the past as well.

Digvijay_Singh_0-1647919548020.png

 

View solution in original post

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I do not see the same behavior as you.  In my similar test the $() expression is evaluated in the state of the containing object.  What version are you using and can you upload a small example that demonstrates the problem?

-Rob

Digvijay_Singh

My test as well evaluates in the state of the containing object but I see wrong conversion in the expression editor, my expression evaluates for 'fr' but expression editor shows 'en', but I have seen such conversion bugs in the expression editor bottom section in the past as well.

Digvijay_Singh_0-1647919548020.png

 

edwin
Master II
Master II
Author

Thank you very much for the swift responses.  i did a little more testing after i saw your messages and realized we were thrown off by the message at the bottom of the xpression builder.  in this example, i selected a language (fr) for state STATE1:

edwin_0-1647970727596.png

then i figured select something for the default state (en):

edwin_1-1647970802922.png

 

this means the expression checker uses the default state even if you selected a state for the object.  so, going back, even if it says there is an error in the expression checker, we went ahead and tested without any selection for default state and it is working fine.

thanks,

edwin

 

edwin
Master II
Master II
Author

hi,

yes this was my observation.  saw this after i posted my reply

thanks

edwin