Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis within an if condtition

Hey Guys,

I'm currently facing trouble with an if condition. More specifically my problem derives from a conditional formating (conditional colour) that I would like to apply to a textbox. Basis of my problem is that I have multiple alternate states and my textbox is set to StateA but the colour should depend on a selection made in StateB. Simply changing the entire alternate state of the object doesn't work since my expressions need to use StateA.

So this was my approach:

=if(SUM({[StateB]}GetSelectedCount(MyField)=0, RGB(400,0,0), RGB(0,0,400))

For some reasons this doesn't work and I wonder whether ther is another way to specify the alternate state StateB for my if condition without changing it for the whole object? Note that the SUM()-function is irrelevant for my calculations I just used it to set StateB.

All I want to do is have the object change the colour if MyField in StateB is not selected.

Thanks for your help and have a good one,

Clemens

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Starting with QV SR8 you can use alternate states in the get* functions:

=if(getselectedcount(MyField, 'StateB'), rgb(255,0,0), rgb(0,255,0)

In earlier versions you can use something like this:

If(count({StateB} distinct MyField) = fieldvaluecount('MyField'), rgb(255,0,0), rgb(0,255,0)


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Starting with QV SR8 you can use alternate states in the get* functions:

=if(getselectedcount(MyField, 'StateB'), rgb(255,0,0), rgb(0,255,0)

In earlier versions you can use something like this:

If(count({StateB} distinct MyField) = fieldvaluecount('MyField'), rgb(255,0,0), rgb(0,255,0)


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks a lot, I used your second proposal:

If(count({StateB} distinct MyField) = fieldvaluecount('MyField'), rgb(255,0,0), rgb(0,255,0))

Not applicable
Author

I'm now facing a follow-up problem and it'd be great if someone could help me with this:

While I wanted to use conditional colouring if no selection is made, I would now like to colour conditionally if a specific value is selected. Again I'm facing the problem of different alternate states: My object is StateA and my Selection will be made in StateB.

So basically what I want to do is colour my StateA textbox in a different colour based on what selection is made in my StateB listbox.

Any suggestions?

Thanks and all the best

Clemens