Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Last record

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

1 Solution

Accepted Solutions

Re: Last record

You need to look at peek function.

Regards

ASHFAQ

5 Replies

Re: Last record

You need to look at peek function.

Regards

ASHFAQ

ecolomer
Honored Contributor II

Re: Last record

You can put an counter, and use RecNo() function

MVP
MVP

Re: Last record

Table1:

Load *, RowNo() as RowNum from <>;

Let vMax=Peek('RowNum');


Noconcatenate

Final:

Load * Resident Table1 where RowNum=$(vMax);

Drop Table Table1;

bwisenosimenkg
Valued Contributor

Re: Last record

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;

sudeepkm
Valued Contributor III

Re: Last record

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

Community Browser