Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
nvijay5757
Creator
Creator

if condition replacement

Hi,

i am writing if condition for each Evaluation. like that i have multiple Evaluation sheets available so i need to do automation. like if i select Evaluation any value then directly display without writing if condition any other alternate.

=If(Evaluation='A','23007_INTd_Gas',
If(Evaluation='B','23208_INTd_Gas 13 kph',
If(Evaluation='C','23217_INTd_Gas 13 kph',
If(Evaluation='D','24030_INTd_3Dr_Base_NSS_Base',
If(Evaluation='E','23620_INTd_RC_4x4_Gas',
If(Evaluation='F','24238_INTd_Gas_FX4 13 kph',
If(Evaluation='G','23757_INTd_On-Road 13 kph',
if(Evaluation='H Trails','23781_INTd_Trail 13 kph',
if(Evaluation='I','23884_INTd_N 12 kph','23004_INTd_Gas')))))))))

variable (v23004) i have created. 

then i am using in chart like

If(Severity_Level='Severity1',Max({<Description={'$(v23006)'}>}Max4),
If(Severity_Level='Severity2',Max({<Description={'$(v23006)'}>}Max14),
If(Severity_Level='Severity3',Max({<Description={'$(v23006)'}>}Max14),
If(Severity_Level='Severity4',Max({<Description={'$(v23006)'}>}Max18),
If(Severity_Level='Severity5',Max({<Description={'$(v23006)'}>}Max18),
If(Severity_Level='Severity6',Max({<Description={'$(v23006)'}>}Max20),
If(Severity_Level='Severity7',Max({<Description={'$(v23006)'}>}Max20),
If(Severity_Level='Severity8',Max({<Description={'$(v23006)'}>}Max28))))))))),'-')

so without writing above if condition any other alternate method please suggest. thanks.

Labels (3)
5 Replies
marcus_sommer

You may replace the nested if-loops with a pick(match()) logic. But this is just a simplifying of the syntax and didn't change the approach itself.

I suggest that you do the essential work within the data-model and using an appropriate mapping for your first if-loop to group/categorize the data and for the second if-loop you should consider to transform the crosstable-structure into a stream-data-structure  per: The Crosstable Load - Qlik Community - 1468083.

- Marcus

nvijay5757
Creator
Creator
Author

Hi,

Thanks for your reply.

i have tried but not working.

i am attaching sample data and QVF can you please check and suggest.

 

 

marcus_sommer

Meant was something like:

m: mapping load * inline [
Evaluation, Value
A, 23007_INTd_Gas

B, 23208_INTd_Gas 13 kph
...
];

t1: crosstable([Min/Max], Value, 😎
      load RecordID, F1, F2, F3, F4, F5, F6, Programm,
                 Min/max-Fields ....
      from Excel;

t2: load *, keepchar([Min/Max], 'Minax') as Type, purgechar([Min/Max], 'Minax') as Number,
                 applymap('m', EvolutionField, 'no match') as XX
       resident t1;

Afterwards a simple max(Value) is enough to return the selection-related results. Should the selections be partly ignored/overwritten Type and Number could be used within a set analysis to modify the results.

- Marcus 

nvijay5757
Creator
Creator
Author

Hi,

Thanks.

in inline every time Value will change, i.e unique. my intention to avoid that every time we enter.

m: mapping load * inline [
Evaluation, Value
A, 23007_INTd_Gas

B, 23208_INTd_Gas 13 kph
...
];

marcus_sommer

The inline is just for demonstration purposes - nobody says you should use it. Nearly everything is better stored and loaded from a data-base or an Excel.

- Marcus