Discussion Board for collaboration on QlikView Scripting.
Hello all,
I need you help with small problem.
I have excel like this:
A B
1 150
1 150
1 150
1 150
1 250
1 168
1 75
My question is how do I select only the last value?
I need that in script, not in expressions
Thanks in advance
Solved! Go to Solution.
You need to look at peek function.
Regards
ASHFAQ
You need to look at peek function.
Regards
ASHFAQ
You can put an counter, and use RecNo() function
Table1:
Load *, RowNo() as RowNum from <>;
Let vMax=Peek('RowNum');
Noconcatenate
Final:
Load * Resident Table1 where RowNum=$(vMax);
Drop Table Table1;
Table1:
load * inline [
A, B
1, 150
1, 150
1, 150
1, 150
1, 250
1, 168
1, 75
];
let vLastA = Peek('A', -1,'Table1');
let vLastB = Peek('B', -1,'Table1');
Table2:
load '$(vLastA)' as A, '$(vLastB)' as B autogenerate 1;
drop table Table2;
Another way of getting the last record and keeping it in a variable.
tab:
load * Inline [
A,B
1,150
1,150
1,150
1,150
1,250
1,168
1,75];
let vLastRecords = Peek('B',NoOfRows('tab')-1,'tab'); // can have another variable for field A