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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
draghici1109
Creator
Creator

Reading variable values from a file

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:

draghici1109_0-1652432661824.png

 

which means the vKPIID1 and vKPIID2 are empty (Null()). What am I doing wrong?

 

Alexandru Draghici
BICC at Komm.ONE
Labels (1)
1 Solution

Accepted Solutions
eddie_wagt
Partner - Creator III
Partner - Creator III

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);

 

View solution in original post

6 Replies
vinieme12
Champion III
Champion III

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);

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
draghici1109
Creator
Creator
Author

Thank you for your quik reaction.

I tested... the same results 🤔

Alexandru Draghici
BICC at Komm.ONE
vinieme12
Champion III
Champion III

Can you post a screenshot of "Einlesen_KPIs" from the data model viewer;  is it actually loading any rows? if yes then how many

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
draghici1109
Creator
Creator
Author

I am doing coding in Qlik View 😁

Here is the screenshot:

draghici1109_0-1652434976921.png

 

Alexandru Draghici
BICC at Komm.ONE
eddie_wagt
Partner - Creator III
Partner - Creator III

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);

 

draghici1109
Creator
Creator
Author

that's right. Now is the world OK! Thank you to all of you!

Alexandru Draghici
BICC at Komm.ONE