Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
livio218526
Creator
Creator

if with multiple value of field

Hello to all,

I have a problem.

I have a field called SCENARIO and I would like to save the value of this in a variable, but according to the following condition:

  • If the SCENARIO field contains the following values "FC 1" and "FC 2" and "FC 3" then I want the variable to contain only the value "FC 3".
  • If the SCENARIO field contains the following values "FC 1" and "FC 2" then I want the variable to contain only the value "FC 2".
  • If the SCENARIO field only contains "FC 1" then I want the variable to contain only the value "FC 1".

I tried with an if but without success.

Thank you,

Livio

14 Replies
sunny_talwar

Where are you going to be using this? On the front end? May be this

MaxString(SCENARIO)

livio218526
Creator
Creator
Author

Front end, but in the field SCENARIO, I have other value, so i think that MaxString(SCENARIO) not working in my case.

pooja_prabhu_n
Creator III
Creator III

Hi,

Try using =MaxString(SCENARIO)

Thanks,

Pooja

sunny_talwar

May be like this

If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 3|) = 1, 'FC 3',

     If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 2|) = 1, 'FC 2',

          If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 1|) = 1, 'FC 1')))

livio218526
Creator
Creator
Author

Not working again

sunny_talwar

My bad, I missed single quotes

If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 3|') = 1, 'FC 3',

     If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 2|') = 1, 'FC 2',

          If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 1|') = 1, 'FC 1')))

livio218526
Creator
Creator
Author

I know, I corrected it but not working too

sunny_talwar

Would you be able to share a sample or image of where you are using this?

livio218526
Creator
Creator
Author

Capture.JPG