Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
vignesh_s
Creator
Creator

need to achieve a logic in the load script which is working in the front end using above function

Hi Folks,

I need to achieve a logic which is working in the front end using above function , if I try to achieve same thing using peek in the load script the result are not same. Below are the sample. the red color fount are out put. Please help me out generate the same out put has above does

IdA1B1C1D1above(D1)peek(D1,-1)
1ab1INDE-DE
2ab2DECNDECN
3ab3CNUSCNUS
4ab4USUKUSUK
5ab5UKRSUKRS

 

Labels (4)
2 Replies
JustinDallas
Specialist III
Specialist III

You could use a Mapping Load   to get what you want.  You only get one column to bring back, so that might be a non-starter for you.  Here is some dummy data that I think does what you're looking for.  Take note of the "Id + 1" term that I've got to create the MappingLoad table

 

DummyData:
LOAD * Inline
[
	'Id','A1', 'B1', 'C1', 'D1'
    1,    a,    b1,   IN,   DE
    2,    a,    b2,   DE,   CN
    3,    a,    b3,   CN,   US
    4,    a,    b4,   US,   UK
    5,    a,    b5,   UK,   RS
]
;

DummyMap:
MAPPING LOAD (Id + 1) AS 'IdMappingKey', D1 
RESIDENT DummyData
;

DummyData2:
LOAD *, 
  PEEK(D1,-1) AS 'PEEK(D1,-1))',
  ApplyMap('DummyMap', Id, Null()) AS 'MappedLoad'  
RESIDENT DummyData
;

DROP TABLE DummyData
;

EXIT Script
;

 

vignesh_s
Creator
Creator
Author

Hi Justin,

 Thanks for the replay, but applymap wont work in  my case because , the table actually will be 

DummyData:
LOAD * Inline
[
'Id','A1', 'B1', 'C1', 'D1'
1, a, b1, IN, DE
2, a, b2, DE, CN
3, a, b3, CN, US
4, a, b4, US, UK
5, a, b5, UK, RS
1, b, c1, IN, DE
2, b, c2, RN, BM
]
;

output:

PFA