Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expressions nested in other expressions

Hello to everyone!

I hope somebody could help me with the problem I'm facing:

In a external .qvs I'm setting the following variables:

SET exp1 = Avg({1<Field1={'Value1'},Field2={'$1'}>}Field3);

SET exp2 = 'Value2';

SET exp3 = ((Sum({<Field3={$1}>}Field4 * Field5))/Sum({<Field3={$1}>}Field6));

SET exp4 = If(QV_Show_Time='Quarterly',

  If($(exp1($(exp2)))>=$(exp3('Value3')),

  vt_ColorPositive,

  If($(exp1($(exp2)))>=($(exp3('Value3')) - 0.05) and $(exp1($(exp2)))<$(exp3('Value3')),

  ' ', vt_ColorNegative)));




Where QV_Show_Time is also a Field, and vt_ColorPositive and vt_ColorNegative are colors defined using the RGB() function.


I use the expression 'exp4' to compare two values and change the font color from a straight table. When I copy exp4 to  'Text Color' of the object it works fine. But if that expression is defined outside in a .qvs it doesn't work. I think that there is one ore more expressions that may be are called wrong (maybe using $(=exp)), but I tried almost all and I didn't found the mistake.

I'll appreciate all the help.

Thanks!

1 Reply
Not applicable
Author

I think I got it! All I have done is to use 'exp4' as a function, replacing the 'exp1' parameter ($(exp2)) with $1 and call the function as following:

$(exp4($(exp2)))

This worked for me. My question is: all expressions using other expressions with parameters, must be paremeterized also with those parameters?

Thanks!