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

Announcements
Save an extra $150 Dec 1–7 with code CYBERWEEK - stackable with early bird savings: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load script: Create a new variabele (with a statement)

Hello,

I have the following issue:

- I have created several TABS in the 'Edit Script' and have loaded several tables frmo my SQL server.

Tabs:Invoice, Shipment, Journal

Tables: InvoiceHeader, InvoiceLines, ShipmentHeader, Journal

Now I created a new TAB named 'Tests' where I want to create a new table (Tests) where I want to make a new variable based on the several variabeles I created the other tables.

Tests:

LOAD

     if([J_Country_Region Code]=[S_Ship-to Country_Region Code],if([Country Code]='BE','Test OK','Country of Stock Error'),if([Country Code]='BE','Test      OK','Shipping Country Error')) AS 'Test 5A';

If I reload my script, it does not create this table or the variable 'Test 5A' I would like to use in my table.

What should I do to make this work or should I create this variable in SQL on my server?

Sidenote:

- I use the renamed variables in this statement from the other tables. I must do this because several variables have the same neam ein the different tables

- I cannot use an expression in qlikview itself to do this because I want to create a pie chart and when I then click on the chart results it looks at the dimensions used in the expression instead of simply looking at the dimension itself.

2 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Use let to create and initialize a variable like this

SET Test5A = Your if condition;

When I checked you If condition it has more parameters.  If has only 3 parameters, Expression, True value and False value.  But your expression has 4 values.

Regards,

Jagan.

Sokkorn
Master
Master

Hi,

Maybe I'm not clear with your point. Let try this

IF ([J_Country_Region Code]=[S_Ship-to Country_Region Code],

    (IF [Country Code]='BE','Test Ok','Country of Stock Error'),

    (IF [Country Code]='BE','Test OK','Shipping Country Error')

)    AS [Test5A];

I think this one does not make sense. Because [Country Code]='BE' is use two time with different condition. If you can attached your small application then is make easy to understand what you looking for.

Regards,

Sokkorn Cheav