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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
nevilledhamsiri
Specialist
Specialist

Nested If statement in Script!

Hi Dear All!

I need to create a simple table box to arrange  how set of people have visited set of countries as per a set schedule & how the plan was changed & carried out the visits. In the process, based on the dimensions  I have created a if statement which gives some scripting errors while loading. Can some one see where I have gone wrong & correct me.

Thanks in advance

Neville

Date_Plan:

LOAD

[Person to visit],

  [place to visit],

  [Set Date Plan],

  [Person visited],

  [Place visited],

  [Ammended Dat Plan],

  IF( [Person to visit]= [Person visited] AND [Set Date Plan]= [Ammended Dat Plan],'ON_DATE_VISIT',IF( [Person to visit]= [Person visited] AND [Set Date Plan]> [Ammended Dat Plan],'ADVANCE_VISIT',

   IF( [Person to visit]= [Person visited] AND [Set Date Plan]< [Ammended Dat Plan],'LATE_DATE_VISIT' AND  IF( [Person to visit]<> [Person visited] AND [Set Date Plan]= [Ammended Dat Plan],'ON_DATE_SUB_VISIT',

   IF( [Person to visit]<> [Person visited] AND [Set Date Plan]< [Ammended Dat Plan],'LATE_DATE_SUB_VISIT', IF( [Person to visit]<> [Person visited] AND [Set Date Plan]> [Ammended Dat Plan],'ADVANCE_SUB_VISIT',

FROM (ooxml, embedded labels, table is Sheet1);

1 Solution

Accepted Solutions
sunny_talwar

May be this


If([Person to visit] = [Person visited],

     If([Set Date Plan] = [Ammended Dat Plan], 'ON_DATE_VISIT',

     If([Set Date Plan] > [Ammended Dat Plan], 'ADVANCE_VISIT',

     If([Set Date Plan] < [Ammended Dat Plan], 'LATE_DATE_VISIT')))

If([Person to visit] <> [Person visited],

     If([Set Date Plan] = [Ammended Dat Plan], 'ON_DATE_SUB_VISIT',

     If([Set Date Plan] < [Ammended Dat Plan], 'LATE_DATE_SUB_VISIT',

     If([Set Date Plan] > [Ammended Dat Plan], 'ADVANCE_SUB_VISIT')))))

View solution in original post

3 Replies
Anonymous
Not applicable

Immediately I can tell you haven't closed any of your parenthesis.

You should have at least 6 closing parentheses at the end if I counted right.

nevilledhamsiri
Specialist
Specialist
Author

Please show me with explanation where it is wrong

Regds

Neville

sunny_talwar

May be this


If([Person to visit] = [Person visited],

     If([Set Date Plan] = [Ammended Dat Plan], 'ON_DATE_VISIT',

     If([Set Date Plan] > [Ammended Dat Plan], 'ADVANCE_VISIT',

     If([Set Date Plan] < [Ammended Dat Plan], 'LATE_DATE_VISIT')))

If([Person to visit] <> [Person visited],

     If([Set Date Plan] = [Ammended Dat Plan], 'ON_DATE_SUB_VISIT',

     If([Set Date Plan] < [Ammended Dat Plan], 'LATE_DATE_SUB_VISIT',

     If([Set Date Plan] > [Ammended Dat Plan], 'ADVANCE_SUB_VISIT')))))