Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to remove Nested If's in a Expression and write it in the Script

Hello Guys,

I have this Nested if's in my Expression of a chart and I am getting "Out of Object Memory" Problem. I want to remove the Nested If's and write these in the Script. Any ideas how to use these fields in the script and again use them in the Chart expression?


=if(Field = 'A'
,
'Field is A'
,
if(Field = 'B'
,
' Field is B'
,
if(Field = 'C'
,
' Field is C'
,
'Field ist not A or B or C'
)

)
)


Thanks

Sravan

5 Replies
Not applicable
Author

Try using set analysis instead:

eg: = sum({$<Field <> { 'A', 'B', 'C', 'D'}>}

it could be that operator ...<> { 'A',.. doesnt work. but there sould be another operator for NOT EQUAL

Not applicable
Author

Humpf having to time to finisch formular:

sum({$<Field <> { 'A', 'B', 'C', 'D'}>}})

Not applicable
Author

Thanks for the answer Boris.

sorry but3 those If's are more of this kind not as in the above example the same fields..


= if (len(KW.TEXT)>0 and len(KU.TEXT)=0
,
OM_PLS_GRUPPIERUNG. <div>Tarifgruppe2 & chr(10) & chr(10) & 'KW '
,
if ( len(KW.TEXT)=0 and len(KU.TEXT)>0
,
OM_PLS_GRUPPIERUNG.Tarifgruppe2 & chr(10) & chr(10) & 'KU
' & OM_PLANSTELLE_KUVERMERK.TRFGR_HOCH
,
if ( len(KW.TEXT)>0 and len(KU.TEXT)>0
,
OM_PLS_GRUPPIERUNG.Tarifgruppe2 & chr(10) & 'KW '
& chr(10) & 'KU auf ' & OM_PLANSTELLE_KUVERMERK.TRFGR_HOCH
,
OM_PLS_GRUPPIERUNG.Tarifgruppe2 & chr(10) &
chr(10)
)
)</div><div>

Not applicable
Author

Hi,

you could try to calculate these fields (result text fields) in script before you display it, rather than calculating it on the surface.

This will boost you performaceof calculation. If you are able to work with relations, it will reduce the complexity of you application as well.

Greedings Boris

Not applicable
Author

Simplify to a single IF:

If(Field <> 'A' AND Field <> 'B' AND Field <> 'C', 'Field is not A, B, or C', 'Field is ' & Field)