

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you would not need quotes for the variables.... use $(vDS_JN) instead of '$(vDS_JN)'.
Hope it helps!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use a text box , write in it $(vDS_JN) and analize the result.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Alessandro,
thx for the reply. Please look at the thread with Reshma.
Kind regards,
Bart
