Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

peek()

tab1:

load *,Peek('c1',2,'tab1') as newtrend inline [
c1,c2
242,423
424,756
42,55
]
;

i cud get data of c1,c2 but nothing is displayed in newtrend.please help me.

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Peek() gives you the previous record values, for first record you don't have any value before that, that is why you are getting null in the first record in newtrend column.  The values populates from the second row onwards.

c1 c2 newtrend
242423
424756242
4255424

Hope this helps you.

Regards,

Jagan.

View solution in original post

5 Replies
prma7799
Master III
Master III

Hi Teja,

Please check below code.

tab1:
load * inline
[
c1,c2
242,423
424,756
42,55
]
;

tab2:
LOAD * , Peek('c1',2,'tab1') as newtrend
Resident tab1;

drop Table tab1;

It may be  helpful to you.

Thanks

PrashantSangle

Hi,
Try with 2nd parameter as 0 or 1.
and Remove 3rd parameter.
try like
load *,Peek('c1',1) as newtrend inline [
c1,c2
242,423
424,756
42,55
]

It must work.
Regards
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this script

tab1:

load *,Peek('c1') as newtrend inline [

c1,c2

242,423

424,756

42,55

];

Also you can use Previous() like below

tab1:

load *,Previous('c1') as newtrend inline [

c1,c2

242,423

424,756

42,55

];

Hope it helps you

Regards,

Jagan.

Not applicable
Author


thanks all,

jagan, if i do as follows, it shoud give all cell values i.e 42,242,424 bcoz after c1 it interprets as 0 and from 1 st cell value, it gives all cell values; but it is giving only 242,424 y?

tab1:

load *,Peek('c1') as newtrend inline [

c1,c2

242,423

424,756

42,55

];

jagan
Luminary Alumni
Luminary Alumni

Hi,

Peek() gives you the previous record values, for first record you don't have any value before that, that is why you are getting null in the first record in newtrend column.  The values populates from the second row onwards.

c1 c2 newtrend
242423
424756242
4255424

Hope this helps you.

Regards,

Jagan.