Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Challenges with peek function

This is my query:

// DEMO LOAD

ORDER:
Load * Inline [
Customer|Order
101|2013
101|2011
102|2009
103|2015
101|2017
103|2018
]
(delimiter is '|');

// THIS DOES NOT WORK

FIRST_ORDER:
Load Customer, Peek(Order,0) As FirstOrder
Resident ORDER;

// WISHED RESULT:
//
// Customer, FirstOrder
// 101, 2011
// 102, 2009
// 103, 2015

--------------------

I expect this result for "FIRST_ORDER" shown in "WISHED RESULT", however have challenge to write the query accordingly.

2 Replies
vamsee
Specialist
Specialist

My Bad I haven't read your column Names correctly

Try

ORDER:
Load * Inline [
Customer|Order
101|2013
101|2011
102|2009
103|2015
101|2017
103|2018
]
(delimiter is '|');

First_Order_Map:
Mapping LOAD
Customer,
Min(Order) as FirstOrder
Resident ORDER
Group By Customer;

FIRST_ORDER:
NoConcatenate
Load

Customer,
ApplyMap('First_Order_Map',Customer) as FirstOrder

Resident ORDER;
DROP Table ORDER;

QlikNoviceNo1
Contributor III
Contributor III

Try this :

ORDER:

Load * Inline [

Customer|Order

101|2013

101|2011

102|2009

103|2015

101|2017

103|2018

] (delimiter is '|');

FIRST_ORDER:

NoConcatenate

Load

Customer,

Min(Order) As FirstOrder

Resident ORDER

Group by Customer;

DROP Table ORDER;