Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mshailaja
Contributor III
Contributor III

if condition

Hi all,

i have written if condition in the script ,  while debugging  with 10000  load i am not getting error,  but while i am doing full load i am getting error as invalid expression , Can anyon eplease help where i am going wrong

Thanks

18 Replies
mshailaja
Contributor III
Contributor III
Author

Anyoneplease look into it

tunoi
Creator
Creator

try

sum(if(NEW_STATUS='RE',Dur) - sum(if(NEW_STATUS='RE' and WildMatch(NEW_STATUS,'SUPS','OP','CL',), Dur)

avinashelite

In order to use the sum you need a Group by clause in your table that is missing

Not applicable

hi,

You can use set analysis instead of IF condition.

If condition has to compare with all the records every time when a script is reloaded,so Qlik will hang.

Always prefer set analysis when any filtering is needed.

syntax will be:

sum({<NEW_STATUS = 'RE'>}Dur)-sum({<NEW_STATUS = {'SUSP*','OP*','CL*'}>}Dur)

Regards,

Balakrishnan.R

Not applicable

Apologies,

Above logic could be used only in Qlikview objects.

For your question , Follow Avinash suggestion.

Regards,

Balakrishnan.R

ashok1203
Creator II
Creator II

In Script, If you want use any aggregate function you need to do use the Group By clause.

AAK
mshailaja
Contributor III
Contributor III
Author

Hi

i have used Group by  in the script, please find the screen shot

while debugging  like limied load 10,000  the script is loading successfulyy, but while reloading  i am getting the error as 'Invalid expression', please help

tamilarasu
Champion
Champion

Hi Sailaja,

Try this,

Group by  PERSID, NEW_STATUS, OLD_STATUS;

All non-aggregated fields must be in a group by clause.

mshailaja
Contributor III
Contributor III
Author

Based on PERSID (common key) i am calculating , if i keep Old_status,new_status, as per my undersatanding i wnt get correct data.  can you please help me