Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hallo community,
you certainly had situations where it seems that the code is correct, yet it does not deliver what we expect. If this is the case, than it is an opportunity to learn something about how qlik is working.
Thank you in advance for your support.
ISSUE:
I want to read the values of two KPIs into two variables. For this I read two rows from a sheet belonging to an xlsx file. Then I use the let assignment to assign the values of the fields read. And yet, this does not work... no idea why. I would expect that you might see where I am "blind".
Here is the code:
Einlesen_KPIs:
LOAD E AS KPIID1,
F AS KPIID2
FROM
[C:\Users\wkiv1150\Desktop\BICC\BICC583\IMPORT\2022 04 01 Problems Kennzahlen fuer Maerz-2022 CMDB-Dashboard - Arbeitsdokument.xlsx]
(ooxml, no labels, header is 10 lines, table is [KPI 1-1 (NEU)])
where RowNo()<1;
store Einlesen_KPIs into [C:\Users\wkiv1150\Desktop\BICC\BICC583\IMPORT\Einlesen_KPIs.csv](txt, delimiter is ';');
/*
Here is the content of the Einlesen_KPIs.csv:
KPIID1;KPIID2
43KUMANZPROBLM;43KUMANZERNEUTPROBLM
*/
let vKPIID1=Peek('KPIID1',-1, Einlesen_KPIs);
let vKPIID2=Peek('KPIID2',-1, Einlesen_KPIs);
trace vKPIID1 $(KPIID1);
trace vKPIID2 $(KPIID2);
##########
The execution of this code look like follows:
which means the vKPIID1 and vKPIID2 are empty (Null()). What am I doing wrong?
You forgot the v in the variable
let vKPIID1=Peek('KPIID1',0, 'Einlesen_KPIs');
let vKPIID2=Peek('KPIID2',0, 'Einlesen_KPIs');
trace vKPIID1 $(vKPIID1);
trace vKPIID2 $(vKPIID2);
minor change, it should be 0 and table name should also be a string, in single quotes
let vKPIID1=Peek('KPIID1',0, 'Einlesen_KPIs');
let vKPIID2=Peek('KPIID2',0, 'Einlesen_KPIs');
trace vKPIID1 $(KPIID1);
trace vKPIID2 $(KPIID2);
Thank you for your quik reaction.
I tested... the same results 🤔
Can you post a screenshot of "Einlesen_KPIs" from the data model viewer; is it actually loading any rows? if yes then how many
I am doing coding in Qlik View 😁
Here is the screenshot:
You forgot the v in the variable
let vKPIID1=Peek('KPIID1',0, 'Einlesen_KPIs');
let vKPIID2=Peek('KPIID2',0, 'Einlesen_KPIs');
trace vKPIID1 $(vKPIID1);
trace vKPIID2 $(vKPIID2);
that's right. Now is the world OK! Thank you to all of you!