Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I need help.
I have this code :
Donnees_Inline:
LOAD * INLINE [
sortie_stock_pn_ic,sortie_stock_pn_article,sortie_stock_date,sortie_stock_quantite,sortie_stock_reference,sortie_stock_type_mouvement
008Q614,61037916AA,30/09/2022,1,,VP
008Q614,61037916AA,02/02/2023,1,,VP
008Q614,61037916AA,28/02/2023,,3,Peremption
008Q614,61037916AA,30/05/2023,1,,VP
008Q614,61037916AA,02/10/2023,1,,VP
008Q614,61037916AA,31/12/2023,,2,Peremption
008Q614,61037916AA,30/01/2024,1,,VP
008Q614,61037916AA,31/05/2024,,5,Peremption
008Q614,61037916AA,02/06/2024,1,,VP
008Q614,61037916AA,30/09/2024,1,,VP
008Q614,61037916AA,31/12/2024,,1,Peremption
1234,1234BB,05/10/2022,1,,VP
1234,1234BB,05/05/2023,1,,VP
1234,1234BB,06/07/2023,,5,Peremption
1234,1234BB,01/10/2024,1,,VP
1234,1234BB,11/11/2024,,1,Peremption
1234,1234BB,03/12/2024,1,,VP
1234,1234BB,12/12/2024,,3,Peremption
];
Donnees:
LOAD sortie_stock_pn_ic & sortie_stock_pn_article as key_ic_article,
sortie_stock_pn_ic,
sortie_stock_quantite,
sortie_stock_quantite as sortie_stock_quantite_cumulative,
if(sortie_stock_reference='',0,sortie_stock_reference) as sortie_stock_reference,
if(sortie_stock_reference='',0,sortie_stock_reference) as sortie_stock_reference_cumulative
,date#(sortie_stock_date,'DD/MM/YYYY') as sortie_stock_date
RESIDENT Donnees_Inline
ORDER BY sortie_stock_pn_ic,sortie_stock_date;
DROP TABLE Donnees_Inline;
NOCONCATENATE
Tmp_Peremptions:
/*LOAD *,
sortie_stock_reference_cumulative-sortie_stock_quantite_cumulative as test
;*/
LOAD
key_ic_article,
sortie_stock_pn_ic,
sortie_stock_date,
sortie_stock_reference,
sortie_stock_quantite,
IF(PREVIOUS(sortie_stock_pn_ic)=sortie_stock_pn_ic,RANGESUM(PEEK(sortie_stock_quantite_cumulative),sortie_stock_quantite_cumulative,0),RANGESUM(sortie_stock_quantite_cumulative,0)) AS sortie_stock_quantite_cumulative,
IF(PREVIOUS(sortie_stock_pn_ic)=sortie_stock_pn_ic,RANGESUM(PEEK(sortie_stock_reference_cumulative),sortie_stock_reference_cumulative,0),RANGESUM(sortie_stock_reference_cumulative,0)) AS sortie_stock_reference_cumulative
//IF(PREVIOUS(sortie_stock_pn_ic)=sortie_stock_pn_ic,RANGESUM(PEEK(sortie_stock_reference_cumulative),sortie_stock_reference_cumulative,0),RANGESUM(sortie_stock_reference_cumulative,0)) AS sortie_stock_reference_cumulative
RESIDENT Donnees
ORDER BY sortie_stock_pn_ic,sortie_stock_date;
Drop table Donnees;
FOR Each pn in FieldValueList('sortie_stock_pn_ic')
Peremptions:
NoConcatenate
LOAD *,
sortie_stock_reference_cumulative-(sortie_stock_quantite_cumulative+new_column) as sortie_stock_date_peremption
;
LOAD
key_ic_article,
sortie_stock_pn_ic,
sortie_stock_date,
sortie_stock_reference_cumulative,
sortie_stock_quantite_cumulative,
IF(PREVIOUS(sortie_stock_pn_ic)=sortie_stock_pn_ic,(sortie_stock_reference_cumulative-rangesum(peek('tmp_quantite_peremption'),sortie_stock_quantite_cumulative)),0) as tmp_quantite_peremption,
IF(PREVIOUS(sortie_stock_pn_ic)=sortie_stock_pn_ic,rangesum(peek('new_column'),peek('tmp_quantite_peremption')),0) as new_column
//sortie_stock_reference_cumulative-rangesum(peek('tmp_quantite_peremption'),sortie_stock_quantite_cumulative) as tmp_quantite_peremption,
//rangesum(sortie_stock_reference_cumulative)-rangesum(peek('tmp_quantite_peremption'),sortie_stock_quantite_cumulative) as tmp_quantite_peremption
RESIDENT Tmp_Peremptions
Where sortie_stock_quantite=''
and sortie_stock_pn_ic='$(pn)'
ORDER BY sortie_stock_pn_ic, sortie_stock_date;
Next pn;
/*GROUP BY key_ic_article,
sortie_stock_pn_ic,
sortie_stock_date;*/
DROP TABLE Tmp_Peremptions;
exit script;
And i don't wont concatenate with table 'Tmp_peremption' and i put a "NoConcatenate" but the loop NoConcetenate when it load a new pn.
How can i resolv it please ? Thanks in advance
What if you do like this?
...Drop table Donnees;
Peremptions:
NoConcatenate Load * [key_ic_article];
FOR Each pn in FieldValueList('sortie_stock_pn_ic')
Concatenate(Peremptions)
LOAD *,
sortie_stock ...