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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to find last value for petricular field

Hi ,

tablename:

LOAD

    @1 as callid,

    @2 as acwtime,

    @3 as ansholdtime,

    @4 as consulttime,

    @5 as disptime,

    @6 as duration,

    @7 as segstart

FROM

    [$(vFilePath)]

where @7>peek('@7',-1,'table name')

(txt, codepage is 1252, no labels, delimiter is ',', msq);

when i am trying to update the table based on the @7>peek('@7',-1,'table name') peek function its not working fine.

segstart contains date and time.

please help me.

Thanks,

1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

Hi,

Try to load a table and find the last value and store it in variable with Peek function

tablename:

LOAD

    @1 as callid,

    @2 as acwtime,

    @3 as ansholdtime,

    @4 as consulttime,

    @5 as disptime,

    @6 as duration,

    @7 as segstart

FROM

[$(vFilePath)]

(ooxml, embedded labels, table is Sheet1);

Let Last = peek('@7',-1,'table name');

TRACE $(Last);

DROP Table [table name];

NewLoad:

LOAD

     callid,

     acwtime,

     ansholdtime,

     consulttime,

     disptime,

     duration,

     segstart

FROM

(ooxml, embedded labels, table is Sheet1)

Where segstart > '$(Last)';

Regards

Anand

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Peek() refers to the output fields from the LOAD, Previous refers to the input fields.

     Where @7 > Previous(@7)     // no quotes

     or

     Where @7 > Peek(segstart)    // no quotes

The 3 parameter version of Peek() is for use outside of a load statement only.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sujeetsingh
Master III
Master III

Load this in a temp table as

RAwData:

LOAD

    @1 as callid,

    @2 as acwtime,

    @3 as ansholdtime,

    @4 as consulttime,

    @5 as disptime,

    @6 as duration,

    @7 as segstart

FROM

    [$(vFilePath)]

Data:

load *

,peek(segstart,1,RAwData) as Last value

resident RawData;

drop table RawData;

its_anandrjs
Champion III
Champion III

Hi,

Try to load a table and find the last value and store it in variable with Peek function

tablename:

LOAD

    @1 as callid,

    @2 as acwtime,

    @3 as ansholdtime,

    @4 as consulttime,

    @5 as disptime,

    @6 as duration,

    @7 as segstart

FROM

[$(vFilePath)]

(ooxml, embedded labels, table is Sheet1);

Let Last = peek('@7',-1,'table name');

TRACE $(Last);

DROP Table [table name];

NewLoad:

LOAD

     callid,

     acwtime,

     ansholdtime,

     consulttime,

     disptime,

     duration,

     segstart

FROM

(ooxml, embedded labels, table is Sheet1)

Where segstart > '$(Last)';

Regards

Anand

Anonymous
Not applicable
Author

Hi Anand,

Thanks for your reply its help full for me.

Thanks,