Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load and auto-complete loop to next value

Good evening

I need to load the following file.

IDs are unique product but the customer name is displayed only once. How should the load script ?

  

order_Idpartner_id
75394__export__.res_partner_1142
75395
75396
75397
75398
75388__export__.res_partner_1142
75389
75390
75391
75392
75393
75383__export__.res_partner_1142
75385
75386
75387
75378__export__.res_partner_1442
75379
75380
75381
75382

thank you very much to all the community QV

6 Replies
Not applicable
Author

Ready found a way , I leave in case someone needs


If ( len ( FieldName) > 0 , FieldName, Peek ( ' NEW' , - 1) ) as NEW,

maxgro
MVP
MVP

do you want to replace the blanks partner_id with the last not blank partner_id?

if yes you can use a resident load with peek

if not post some data and the result you want to get

sunny_talwar

Make sure you sort it in correct manner (using Order By) so that the output you get is what you wanted.

HTH

Best,

Sunny

alexandros17
Partner - Champion III
Partner - Champion III

This is my example and it works:


AAA:
LOAD * Inline [
Order, Partner
1,a
3,
11,
5,b
7,
2,c
9,d
4,
]
;

Do

BBB:
Load Count(Order) as tot_without_value Resident AAA Where IsNull(Partner) or Trim(Partner)='';
Let vTot = Peek('tot_without_value', 0, 'BBB');
Let vTot = If(RangeSum('$(vTot)',0)=0, 0, $(vTot));
DROP Table BBB;

If $(vTot) > 0 then
CCC:
NoConcatenate
LOAD Order, If(IsNull(Partner) or Trim(Partner)='', Previous(Partner), Partner) as Partner Resident AAA;
DROP Table AAA;

AAA:
NoConcatenate
LOAD * Resident CCC;
DROP Table CCC;

ENDIF

LOOP while $(vTot) > 0

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Close the discussion by marking your own answer as correct. Otherwise other community members looking for a similar solution won't find your example. Thanks

Peter

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

You need to use PEEK function to look back where partner_id is NULL or LEN = 0 to return last populated partner_id.