Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Qlikview user
I have declared the following variables in a load script, but I would like them to be stored into a table in the script
I.e.
Variables:
$(vField_OPD1_Table) = 'Division';
$(vField_OPD2_Table) = 'Care_Group';
From...........
Can anyone kindly help
Kind Regards
Helen
You can use variables in your load script like below:
Table:
Load
...
...
$(vField_OPD2_Table) as FieldName
...
...
;
you can also define your variable to accept an input and return an output like below:
Let IsEmpty = If(Isnull($1),'Yes','No'); |
then use during load as:
$(IsEmpty([Field_to_Qualify])) as Flag_Empty,
Hello Jonathan
So far I have done this
1. Declared the variables
LET vField_OPD1_Table = 'Division';
LET vField_OPD2_Table = 'Care_Group';
2. Added in a table
DivVar:
Load
$(vField_OPD2_Table) as 'Divvar',
'DIV' AS 'DivisionName';
However the script is now erroring, do have to have a from or resident clause for my DivVar table?
Kind Regards
Helen
Hi Pippard,
so its practically same as
...
'Division' as 'Diwar',
...
This is not the calculated variables try to shift SET from LET
Is 'Division' a field in your Resident Table?
Hello Jonathan
Yes, Division is in my main fact table and I can resident load it in
However all I want achieve is a table which contains the word "Division" through a variable (Which the variables is doing") and an additional dummy field in the table
I.e. Table results to be in 2 columns
Division Div
Division Div
Care_Group CG
Care_Group CG
The first column will come from the variable and the seocnd column is the dummy field.
However my table is failing to load
Kind Regards
Helen
Ultimately I am try to achieve this: Set the active field in a cyclic group.qvw
Hi Helen
try something like this
SET vField_OPD1_Table = 'Division';
DivVar:
Load
'$(vField_OPD1_Table)' as Divvar
AutoGenerate(1);
Bingo, this did it for me. My code was exactly like the above. Didn't work. But when I switched LET to SET, it worked. IMHO, this is a POS coding syntax. Qlik makes easy things very hard.
The documentation says SET does assignment without calculation. That is, SET assigns a literal. But I have a function call on the right side of the equals sign. In my book that amounts to a calculation. E.g., A + B is a calculation SUM(A, B) would likewise be a calculation.
But, apparently, Qlik doesn't see it that way.
SET v_QVD_last_update = QVDCREATETIME('lib://QVD_Extract\f_qlik_load.qvd'); puts the time into the variable.
LET v_QVD_last_update = QVDCREATETIME('lib://QVD_Extract\f_qlik_load.qvd'); causes an error when I try to look at the time.