Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a variable called vUserChoices with definition below:
If(vUserChoice1 = 'A',
If(vUserChoice2 = 'AA', $(vUserChooseAA),
If(vUserChoice2 = 'AB', $(vUserChooseAB),
If(vUserChoice2 = 'AC', $(vUserChooseAC)
)))
If(vUserChoice1 = 'B',
If(vUserChoice2 = 'BA', $(vUserChooseBA),
If(vUserChoice2 = 'BB', $(vUserChooseBB),
If(vUserChoice2 = 'BC', $(vUserChooseBC)
)))
))
Later on, in my chart expression, I will use Count($(vUserChoices)), Sum($(vUserChoices)), etc. , so I suppose vUserChoices would be replaced by vUserChooseXX based on vUserChoice1 and vUserChoice2.
It seems the numbers I get is not what I expect. Is there anything wrong here with my syntax?
Hi,
Ive seen the expression, seems to me like theres a syntax error on the middle, missing a comma here
"
)))
If(vUserChoice1 = 'B',
"
where it should be
"
))),
If(vUserChoice1 = 'B',
"
:
=
If(vUserChoice1 = 'A',
If(vUserChoice2 = 'AA',$(vUserChooseAA),
If(vUserChoice2 = 'AB',$(vUserChooseAB),
If(vUserChoice2 = 'AC',$(vUserChooseAC)
))),
If(vUserChoice1 = 'B',
If(vUserChoice2 = 'BA',$(vUserChooseBA),
If(vUserChoice2 = 'BB',$(vUserChooseBB),
If(vUserChoice2 = 'BC',$(vUserChooseBC)
))))
)
Ive idented the expression in the app since to me it becomes clearer as to the if / then / else of every statement.
Don't know the other things you need to do with the variables, but attached a quick example.
Hope it helps
Thanks for catching that missing comma. But still the numbers I get are slightly different than using the Count function directly in the chart expression like below. Is that even possible?
If(vUserChoice1 = 'A',
If(vUserChoice2 = 'AA',Count($(vUserChooseAA)),
If(vUserChoice2 = 'AB',Count($(vUserChooseAB)),
If(vUserChoice2 = 'AC',Count($(vUserChooseAC))
))),
If(vUserChoice1 = 'B',
If(vUserChoice2 = 'BA',Count($(vUserChooseBA)),
If(vUserChoice2 = 'BB',Count($(vUserChooseBB)),
If(vUserChoice2 = 'BC',Count($(vUserChooseBC))
))))
)
I'd say its better if you explained what the end result should be (what data you have, whats the desired result and so on), or share the app so we can take a look.