Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
good night I need to add an if to this script
if weekday(today()) = 'dom' then ... else .... endif
that is, if it's Sunday, I need the script like that.
tmp_Vta_Act_6W:
LOAD %Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A') as Pto_vta,
ApplyMap('Map_Clasific_art', %Art_ID,'N/A') as Clasificación,
if ( (Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))>456
,'Mismas Tiendas'
,if(((Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))<456)
,'Nuevas'
)
) as Master_Antiguedad,
sum(Cantidad_Estandar) as Cant_Estandar_Act6W
FROM
Modelo\Fact_Comercial.qvd (qvd)
where
Status <> 'C'
//and (Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))>=456// se Agrega calculo para mismas tiendas
and ApplyMap('Map_Calendario_Sem', Fecha,0)<= $(vMaxValue)
and ApplyMap('Map_Calendario_Sem', Fecha,0)>= $(vMaxValue)-5
and WildMatch( ApplyMap('Map_Clasific_art', %Art_ID,'N/A'), 'Mac', 'Ipad', 'Iphone', 'Apple Watch', 'Accesorios Apple')
Group by %Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A'),
ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A'),
ApplyMap('Map_Clasific_art', %Art_ID,'N/A')
;
Store tmp_Vta_Act_6W into [..\1_QVDs\Transformación\Fact\Temp\tmp_Vta_Act_6W.qvd](qvd);
drop table tmp_Vta_Act_6W;
//Año Anterior
tmp_Vta_Ant_6W:
LOAD %Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A') as Pto_vta,
ApplyMap('Map_Clasific_art', %Art_ID,'N/A') as Clasificación,
if ( (Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))>456
,'Mismas Tiendas'
,if(((Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))<456)
,'Nuevas'
)
) as Master_Antiguedad,
sum(Cantidad_Estandar) as Cant_Estandar_Ant6W
FROM
Modelo\Fact_Comercial.qvd (qvd)
where
Status <> 'C'
//and (Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))>=456// se Agrega calculo para mismas tiendas
and ApplyMap('Map_Calendario_Sem', Fecha,0)<= $(vMaxValue)-52
and ApplyMap('Map_Calendario_Sem', Fecha,0)>= $(vMaxValue)-57
and WildMatch( ApplyMap('Map_Clasific_art', %Art_ID,'N/A'), 'Mac', 'Ipad', 'Iphone', 'Apple Watch', 'Accesorios Apple')
Group by %Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A'),
ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A'),
ApplyMap('Map_Clasific_art', %Art_ID,'N/A')
;
Store tmp_Vta_Ant_6W into [..\1_QVDs\Transformación\Fact\Temp\tmp_Vta_Ant_6W.qvd](qvd);
drop table tmp_Vta_Ant_6W;
//calculo 6 W
Let vVtaSemanaDía = date(today(), 'YYYYMMDD');
//eed: falta agregar UNA COLUMNA DE FECHA ....
tmp_vta_6Wbl$(vVtaSemanaDía):
Load
%Pto_vta_ID,
Clasificación,
date(today()) as Fecha_Master,
Cant_Estandar_Act6W
FROM
Transformación\Fact\Temp\tmp_Vta_Act_6W.qvd (qvd)
where Master_Antiguedad='Mismas Tiendas';
left join
LOAD
%Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A') as Pto_vta,
Clasificación,
date(today()) as Fecha_Master,
Cant_Estandar_Ant6W
FROM
Transformación\Fact\Temp\tmp_Vta_Ant_6W.qvd (qvd)
where Master_Antiguedad='Mismas Tiendas';
CALL QVDGenerator_Vta('Fact') ;
otherwise, it is so
tmp_Vta_Act_6W:
LOAD %Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A') as Pto_vta,
ApplyMap('Map_Clasific_art', %Art_ID,'N/A') as Clasificación,
if ( (Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))>456
,'Mismas Tiendas'
,if(((Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))<456)
,'Nuevas'
)
) as Master_Antiguedad,
sum(Cantidad_Estandar) as Cant_Estandar_Act6W
FROM
Modelo\Fact_Comercial.qvd (qvd)
where
Status <> 'C'
and ApplyMap('Map_Calendario_Sem', Fecha,0)<= $(vMaxValue)-1
and ApplyMap('Map_Calendario_Sem', Fecha,0)>= $(vMaxValue)-6
and WildMatch( ApplyMap('Map_Clasific_art', %Art_ID,'N/A'), 'Mac', 'Ipad', 'Iphone', 'Apple Watch', 'Accesorios Apple')
Group by %Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A'),
ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A'),
ApplyMap('Map_Clasific_art', %Art_ID,'N/A')
;
Store tmp_Vta_Act_6W into [..\1_QVDs\Transformación\Fact\Temp\tmp_Vta_Act_6W.qvd](qvd);
drop table tmp_Vta_Act_6W;
//Año Anterior
tmp_Vta_Ant_6W:
LOAD %Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A') as Pto_vta,
ApplyMap('Map_Clasific_art', %Art_ID,'N/A') as Clasificación,
if ( (Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))>456
,'Mismas Tiendas'
,if(((Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))<456)
,'Nuevas'
)
) as Master_Antiguedad,
sum(Cantidad_Estandar) as Cant_Estandar_Ant6W
FROM
Modelo\Fact_Comercial.qvd (qvd)
where
Status <> 'C'
//and (Num(Today())-Num(ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A')))>=456// se Agrega calculo para mismas tiendas
and ApplyMap('Map_Calendario_Sem', Fecha,0)<= $(vMaxValue)-53
and ApplyMap('Map_Calendario_Sem', Fecha,0)>= $(vMaxValue)-58
and WildMatch( ApplyMap('Map_Clasific_art', %Art_ID,'N/A'), 'Mac', 'Ipad', 'Iphone', 'Apple Watch', 'Accesorios Apple')
Group by %Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A'),
ApplyMap('Map_Antiguedad', %Pto_vta_ID,'N/A'),
ApplyMap('Map_Clasific_art', %Art_ID,'N/A')
;
Store tmp_Vta_Ant_6W into [..\1_QVDs\Transformación\Fact\Temp\tmp_Vta_Ant_6W.qvd](qvd);
drop table tmp_Vta_Ant_6W;
//calculo 6 W
Let vVtaSemanaDía = date(today(), 'YYYYMMDD');
//eed: falta agregar UNA COLUMNA DE FECHA ....
tmp_vta_6Wbl$(vVtaSemanaDía):
Load
%Pto_vta_ID,
Clasificación,
date(today()) as Fecha_Master,
Cant_Estandar_Act6W
FROM
Transformación\Fact\Temp\tmp_Vta_Act_6W.qvd (qvd)
where Master_Antiguedad='Mismas Tiendas';
left join
LOAD
%Pto_vta_ID,
ApplyMap('Map_Pto_vta_ID', %Pto_vta_ID,'N/A') as Pto_vta,
Clasificación,
date(today()) as Fecha_Master,
Cant_Estandar_Ant6W
FROM
Transformación\Fact\Temp\tmp_Vta_Ant_6W.qvd (qvd)
where Master_Antiguedad='Mismas Tiendas';
CALL QVDGenerator_Vta('Fact') ;
can anybody help me?
Attached
Hola Eldred,
Please elaborate,
is it a simple one line like this:
if(condition , then , else)
Of a more complex one like this?
if x>0 then
LOAD * from pos.csv;
elseif x<0 then
LOAD * from neg.csv;
else
LOAD * from zero.txt;
end if
Saludos,
Luis
Attached