Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
J'aimerais par une boucle qui pour chaque numéros d'erreurs inférieure à 600 va rechercher la prochaine valeur fixe de 607 puis faire une différence entre les deux dates correspondante et ainsi de suite pour enfin faire la somme des différences obtenues pour chaque id
Maye be :
Datatmp:
LOAD ID,
erreur,
Timestamp(dates) as dates
FROM
.\ClasseurTest.xlsx
(ooxml, embedded labels, table is Feuil1);
Data:
noconcatenate
load * resident Datatmp where (erreur <600 or erreur = 607 ) order by ID,dates ;
drop table Datatmp;
tmp2:
noconcatenate
load *,
if(rowno()=1,0,if(erreur=607,peek(value3),if(previous(erreur)<607,peek(value3),peek(value3)+1))) as value3,
if(erreur=607 and previous(erreur)=607,1,0) as Flog2
resident Data;
drop table Data;
tmp3:
load ID,value3,Timestamp(Max(dates)) as Maxdates,Timestamp(Min(dates)) as Mindates,Time(Timestamp(Max(dates))-Timestamp(Min(dates))) as Interval resident tmp2 where Flog2=0 group by ID,value3;
drop table tmp2;
Final:
load ID ,Time(sum(Interval)) as Cumul resident tmp3 group by ID;
drop table tmp3;
Maye be :
Datatmp:
LOAD ID,
erreur,
Timestamp(dates) as dates
FROM
.\ClasseurTest.xlsx
(ooxml, embedded labels, table is Feuil1);
Data:
noconcatenate
load * resident Datatmp where (erreur <600 or erreur = 607 ) order by ID,dates ;
drop table Datatmp;
tmp2:
noconcatenate
load *,
if(rowno()=1,0,if(erreur=607,peek(value3),if(previous(erreur)<607,peek(value3),peek(value3)+1))) as value3,
if(erreur=607 and previous(erreur)=607,1,0) as Flog2
resident Data;
drop table Data;
tmp3:
load ID,value3,Timestamp(Max(dates)) as Maxdates,Timestamp(Min(dates)) as Mindates,Time(Timestamp(Max(dates))-Timestamp(Min(dates))) as Interval resident tmp2 where Flog2=0 group by ID,value3;
drop table tmp2;
Final:
load ID ,Time(sum(Interval)) as Cumul resident tmp3 group by ID;
drop table tmp3;