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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Test Condition and Drop Fields

I currently have an app that loads from a binary qvw.


binary c:\accesspoint\IBA_Source_$(vTheater).qvw;
//Drop unecessary fields from certain app versions
If $(vTheater) <> 'Global' then
drop field [CPL ID];
drop field [Contract ID];
endif


The vTheater variable is changed via repeat task in Publisher but for this discussion assume it is manually set. (Possible variable values include USA, APAC, EMEA, Global, etc....)

The problem is that regardless of the value of vTheater the fields are being dropped. I have tested a text object to check the value of vTheater as 'Global' and yet the two fields are still being dropped.

Any idea thoughts on why the if condition is being ignored? Is there a better way to selectively drop fields when a condition is met?

-Ed

1 Solution

Accepted Solutions
disqr_rm
Partner - Specialist III
Partner - Specialist III

Try without '$' sign.

If vTheater <> 'Global' then
drop field [CPL ID];
drop field [Contract ID];
endif

If doesn't work, debug it and make sure the values are getting populated correct. Sometime it could be an extra space at the end or upper/lower case problem. In that case you could use Trim(vTheater) or upper(vTheater).

View solution in original post

3 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

Try without '$' sign.

If vTheater <> 'Global' then
drop field [CPL ID];
drop field [Contract ID];
endif

If doesn't work, debug it and make sure the values are getting populated correct. Sometime it could be an extra space at the end or upper/lower case problem. In that case you could use Trim(vTheater) or upper(vTheater).

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think it should be:

If '$(vTheater)' <> 'Global' then

Note the quotes around the variable.

-Rob

disqr_rm
Partner - Specialist III
Partner - Specialist III

That could be it too. I always play with these 2-3 options when I have problem with variables. One of these surely works all the time.

My experience was only to use '$' if you are using variables with the load. Anyway, I am sure once of these trick will sole the issue for now.