Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello QV genius,
How do you make an IF STATEMENT for alternate states?
Like for example:
If(alternate_state=test, sum(field), if(alternate_state=test2, sum(field)))
Is it possible? Because I want my pie chart to calculate only one expression but based on what alternate state.
Thanks a lot.
Hi.
Alternative state is simply the set of selections in fields. If there are two alternative states they are both exist all the time containing different sets of selections.
Could you describe the issue in detail or add a sample ?
i think this should work
If(alternate_state=test, sum(field), if(alternate_state=test2, sum(field)))
or if test and test2 are data then you could
If(alternate_state='test', sum(field), if(alternate_state='test2', sum(field)))
I have a pie chart with one expression: sum(total)
Then I have 2 Straight tables(table1 and table2) both in different state: State1 and State2 respectively.
I want that if I select table1, the pie chart will calculate the sum. And if I choose table2 , it will do the same.
I don't want to do comparative analysis since I am using pie chart. I just want the pie chart to update on which state it is being calculated. Thanks.
What is the syntax for getting the alternate states? That's what I want
You can find about alternate state in the Reference Manual.
The problem here is your statement "I want that if I select table1...". You can't "select" a table. Do you mean click this table and make it the active object? There used to be an OnActivate Object trigger you could have used for this purpose. but it was removed in QV11. So you may have to use a button or listbox as the control for letting the user select which State the Pie Chart should reflect.
-Rob
You can go even further. It depends on the problem that you're trying to help to solve for the user.
For example, place the transparent text objects on top of the straight tables and use the actions to treigger the variable. Then you can use the variable to trigger the expression in pie chart and to make some visual accents like object color to visualize the selection.