Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Formulas with two alternate states

Hello Guys,

I have these formulas, where the field "OPTIONAL" comes from a different alternate state called "State10"

=Chr(39)&Replace(GetFieldSelections(OPTIONAL,',', GetSelectedCount(OPTIONAL)), ',' , chr(39)&','&chr(39)) &chr(39)

how do I add the alternative state to this formula???

Thank you already

1 Solution

Accepted Solutions
sbaldwin
Partner - Creator III
Partner - Creator III

Try:

=if(count({1} OPTIONAL) = count({State10} OPTIONAL),'blank',    replace( '#'&Concat({State10} OPTIONAL,'#,#')&'#','#',chr(39)))

View solution in original post

9 Replies
Not applicable
Author

state_name::field_name

Not applicable
Author

If I go like this:

=Chr(39)&Replace(GetFieldSelections(State10::OPTIONAL,',', GetSelectedCount(State10::OPTIONAL)), ',' , chr(39)&','&chr(39)) &chr(39)

The expression appears to be wrong, what should I do?

Not applicable
Author

Try this:

=Chr(39)&Replace(GetFieldSelections([State10]::OPTIONAL,',', GetSelectedCount([State10]::OPTIONAL)), ',' , chr(39)&','&chr(39)) &chr(39)


Don't worry if it's not parsing, it just happens sometimes with set analysis

Not applicable
Author

Tried with the error but ended up still not working.

sbaldwin
Partner - Creator III
Partner - Creator III

Hi, i don't think you can use the state::field syntax with this system function, have you tried something like

=replace( '#'&Concat({State10} OPTIONAL,'#,#')&'#','#',chr(39))

Thanks

Steve

simondachstr
Luminary Alumni
Luminary Alumni

You can't use set analysis with the GetFieldSelections() function. Use an embedded Only function instead e.g.:

GetFieldSelections(Only({State10} OPTIONAL)) etc...

Not applicable
Author

It worked perfectly buddy, however, the list starts with all OPTIONALS selected, and I need that to start 'blank', with no selections at the beginning.

Is that possible?

sbaldwin
Partner - Creator III
Partner - Creator III

Try:

=if(count({1} OPTIONAL) = count({State10} OPTIONAL),'blank',    replace( '#'&Concat({State10} OPTIONAL,'#,#')&'#','#',chr(39)))

Not applicable
Author

Thank you so much. Worked perfectly.