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

trouble using variables in expression editor to produce desired results

Hello,

I have trouble using variables in the expression editor.

I have a variable named EXAMPLE_v, for this I have created alternatives which hold values (500,600,800,0)

I have two table entry fields TABLE_field_a, TABLE_field_b

What I need is when EXAMPLE_v=0, take TABLE_field_b of all Table rows

When EXAMPLE_v !=0, take TABLE_field_b of only Table rows where EXAMPLE_v=TABLE_field_a

I tried the below but it works only when EXAMPLE_v=0

if($(EXAMPLE_v)=0,TABLE_field_b , if($(EXAMPLE_v)=TABLE_field_a,TABLE_field_b ))

Regards,

Anil

1 Solution

Accepted Solutions
andrey_krylov
Specialist
Specialist

Hi,  Anil. If I understood you correctly, try this

Sum( {< TABLE_field_a = {"$(=If( $(EXAMPLE_v) = 0, '*', $(EXAMPLE_v)))"} >} TABLE_field_b )

but your expression should work as well...

View solution in original post

4 Replies
andrey_krylov
Specialist
Specialist

Hi,  Anil. If I understood you correctly, try this

Sum( {< TABLE_field_a = {"$(=If( $(EXAMPLE_v) = 0, '*', $(EXAMPLE_v)))"} >} TABLE_field_b )

but your expression should work as well...

Anonymous
Not applicable
Author

Hi Andrey,

Thanks for your response, I tried the suggested expression.

With my expression only EXAMPLE_v=0 was working.

Where as with your expression, irrespective of the EXAMPLE_v value, it always results in the EXAMPLE_v=0

I find the syntax very very difficult to understand and not much helpful scripting tutorials available 🙂

I am just trying to use scatter plots, using the EXAMPLE_v variable plot only the relevant table entries

Regards,

Anil

Anonymous
Not applicable
Author

Hi Andrey,

I looked into the issue and it seems as you suggested my expression is indeed working.

What I can only comment is that, I did a complete new import of my data and cleaned up unnecessary stuff and then I observe the intended behavior.

Regards,

Anil

andrey_krylov
Specialist
Specialist

Hi Anil,

I'm glad that you managed to solve this issue.