9 Replies Latest reply: Feb 24, 2014 7:41 AM by Julio Lourenco

# 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???

• ###### Re: Formulas with two alternate states

state_name::field_name

• ###### Re: Formulas with two alternate states

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?

• ###### Re: Formulas with two alternate states

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

• ###### Re: Formulas with two alternate states

Tried with the error but ended up still not working.

• ###### Re: Formulas with two alternate states

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

• ###### Re: Formulas with two alternate states

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

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

• ###### Re: Formulas with two alternate states

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?

• ###### Re: Formulas with two alternate states

Try:

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

• ###### Re: Formulas with two alternate states

Thank you so much. Worked perfectly.