Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
SoillBIQlikSense
Contributor
Contributor

peek and index columns

Good day

I need to index and match columns

I have a table that looks like this

SoillBIQlikSense_0-1600081004462.png

I would like to peek and index a new column with like this... to have new column ax XXXXX  in lineNo 0 to 3 and AAAAA in lineNo 4 to 6.I tried this but I get the wrong results

Test:
LOAD * inline [
Doc|ItemCode|LineNo|TreeType
1|XXXXX|0|S
1|BP1|1|I|
1|BP2|2|I|
1|BP3|3|I|
1|AAAAA|4|S
1|SP2|5|I|
1|SP3|6|I|
1|SP5|7|I|
1|SP6|8|I|
] (delimiter is '|');
Test2:
Load
Doc,ItemCode,LineNo,TreeType,
IF(peek(Doc,-1)=Doc and TreeType = 'I' ,peek(ItemCode),ItemCode)
as peeksresults1
Resident Test order by LineNo;

 

Thank you

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@SoillBIQlikSense  try below

Load
Doc,ItemCode,LineNo,TreeType,
IF(TreeType = 'S' ,ItemCode,peek(ItemCodeNew)) as ItemCodeNew
as peeksresults1
Resident Test order by LineNo;

View solution in original post

5 Replies
Kushal_Chawda

@SoillBIQlikSense  do you always have two Tree Type?

SoillBIQlikSense
Contributor
Contributor
Author

Yes ,S is the Father Tree type and the I are the children. The children must be linked to the right father, eg. XXXXX the children are 0,1,2,3 so the new column must be XXXXX for these lines and be AAAAA for line 5,6.7,8 Thank you

Kushal_Chawda

@SoillBIQlikSense  try below

Load
Doc,ItemCode,LineNo,TreeType,
IF(TreeType = 'S' ,ItemCode,peek(ItemCodeNew)) as ItemCodeNew
as peeksresults1
Resident Test order by LineNo;

SoillBIQlikSense
Contributor
Contributor
Author

Thank you , a big thank you.This works 100%.