Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
vengadeshpalani
Creator
Creator

Why null values stored in variables

Hi all,

In the below screenshot, I've got null values in variables as marked in the screenshot. Please anyone could say what I did wrong in the script?

Screenshot_3.png

A:

LOAD VarCustomer, IN, OUT

FROM (biff, embedded labels, table is Sheet1$);

let noRows = NoOfRows('A');

TRACE '$(noRows)';

for i=1 to $(noRows)

TRACE '----------------------------------------------'; 

TRACE '$(i)'; 

let vVar=  FieldValue('VarCustomer',$(i)) ;

let vOriginFormat = FieldValue('IN',$(i));

let vDestinationFormat = FieldValue('OUT',$(i));

TRACE '$(vVar)';

TRACE '$(vOriginFormat)';

TRACE '$(vDestinationFormat)';

next i

EXIT SCRIPT;

1 Solution

Accepted Solutions
sunny_talwar

Use Peek()

A:

LOAD VarCustomer,

IN,

OUT

FROM [test2.xls]

(biff, embedded labels, table is Sheet1$);

let noRows = NoOfRows('A');

TRACE '$(noRows)';

for i=0 to $(noRows)-1

TRACE '----------------------------------------------'; 

TRACE '$(i)'; 

let vVar=  Peek('VarCustomer',$(i)) ;

let vOriginFormat = Peek('IN',$(i));

let vDestinationFormat = Peek('OUT',$(i));

TRACE '$(vVar)';

TRACE '$(vOriginFormat)';

TRACE '$(vDestinationFormat)';

next i

EXIT SCRIPT;

View solution in original post

5 Replies
Anil_Babu_Samineni

May bebe for thatthat field index value you dont have data so then null produced. Check that.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Because IN has only one value HR, so FieldValue('IN', 2) and FieldValue('IN', 3) and FieldValue('IN', 4) are all null. Out has two values, so 3 and 4 are null... FieldValue looks at the distinct value within a field and that's why 2, 3, 4 for IN doesn't show anything

vengadeshpalani
Creator
Creator
Author

I want to show related value instead of null value means what I want to change in script

sunny_talwar

Use Peek()

A:

LOAD VarCustomer,

IN,

OUT

FROM [test2.xls]

(biff, embedded labels, table is Sheet1$);

let noRows = NoOfRows('A');

TRACE '$(noRows)';

for i=0 to $(noRows)-1

TRACE '----------------------------------------------'; 

TRACE '$(i)'; 

let vVar=  Peek('VarCustomer',$(i)) ;

let vOriginFormat = Peek('IN',$(i));

let vDestinationFormat = Peek('OUT',$(i));

TRACE '$(vVar)';

TRACE '$(vOriginFormat)';

TRACE '$(vDestinationFormat)';

next i

EXIT SCRIPT;

Anonymous
Not applicable

Sunny,

Please find this attached QVW file. I'm having the same null values issue, but I've used Peek function only. Kindly help.