Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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_Id | partner_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
Ready found a way , I leave in case someone needs
If ( len ( FieldName) > 0 , FieldName, Peek ( ' NEW' , - 1) ) as NEW,
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
Make sure you sort it in correct manner (using Order By) so that the output you get is what you wanted.
HTH
Best,
Sunny
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
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
Hi,
You need to use PEEK function to look back where partner_id is NULL or LEN = 0 to return last populated partner_id.