Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

If statement with variable in load script

Dear,

I'm trying to check the existence of a field in table. I have a variable called vDS_JN  in which I put wether or not the field is present.

But why is it that my load statement is not honoring the if statement. (Error: fieldname does not exist 'ds')

The variable holds the value 'nee' so it should take 0 as value for the field ds

If the variable holds the value 'ja' it should use the existing field ds as ds. (this variant works without receiving the error).

Can someone help me out on this one?

Thank you very much in advance!

Bart

1 Solution

Accepted Solutions
Highlighted
Creator
Creator

Reshma,

thx for the quick reply. If I unquote QlikView says that the 'field 'nee'' does not exist. If i use the variable without $ and quotes QlikView sees vDS_JN as a field so i get an error of course.

Spoken with QlikView support. They say that the use of the IF() in this particular way is out of league. I made my solution this way:

I create a separate table depending on the existence of the field DS. So my base structure of TRANSACT is always the same and the table. (I'm running in a for next loop with 1200 transact tables.

View solution in original post

7 Replies
Highlighted
Creator III
Creator III

you would not need quotes for the variables.... use $(vDS_JN) instead of '$(vDS_JN)'.

Hope it helps!

Highlighted

Are you sure vDS_JN contains value 'nee'? Check the Document Log; In it, all text expansion is performed before the statements are printed. So you can see for yourself what the PRECEDING LOAD is trying to do during that particular run.

Best,

Peter

Highlighted
Creator
Creator

Peter,

thx for the tip. Never knew that the log could show the debugged version of the preceding load!

The value was indeed 'nee' by the way.

Bart

Highlighted

When you use variable you have to omit ' otherways it is read as text so

'$(vDS_JN)' is exactly the string $(vDS_JN) not its value, write (all the varibles) without leading and trailing apex.

Let me know

Highlighted
Creator
Creator

Reshma,

thx for the quick reply. If I unquote QlikView says that the 'field 'nee'' does not exist. If i use the variable without $ and quotes QlikView sees vDS_JN as a field so i get an error of course.

Spoken with QlikView support. They say that the use of the IF() in this particular way is out of league. I made my solution this way:

I create a separate table depending on the existence of the field DS. So my base structure of TRANSACT is always the same and the table. (I'm running in a for next loop with 1200 transact tables.

View solution in original post

Highlighted

Use a text box , write in it $(vDS_JN) and analize the result.

Highlighted
Creator
Creator

Dear Alessandro,

thx for the reply. Please look at the thread with Reshma.

Kind regards,

Bart