Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
julruiz123
Partner - Creator
Partner - Creator

Problem to get the day from date

Hi,

I have the next situation

LET vDate = Today();



//Obtener hasta que fecha actualizar el histórico

IF Day($(vDate)) = 24 THEN

...

ELSE

...

ENDIF


Today is 24 but when i run the script runs "else" expression.


In text object shows the value such as


Day($(vDate)) = 30

Day(vDate) = 24


Why ??


Thanks!

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

vDateUpdate is a literal, so you need to use single quotes to match the format returned by the Date() function:

Where Date(fecha_factura) <= '$(vDateUpdate)';

Hope that helps.

Miguel

View solution in original post

5 Replies
Not applicable

If you create a variable in variable overview you need to use "$" in order to evaluate the expression.

If you are trying to get the value using script you don't have to use $.

Miguel_Angel_Baeyens

Hi,

Why not use the Day() function in the LET variable assignment?

LET vDate = Day(Today());

Hope that helps.

Miguel

julruiz123
Partner - Creator
Partner - Creator
Author

Now i have the code in this way

LET vDate = Today(); //Fecha actual

LET vDay = Day(Today()); //Día actual

//Obtener hasta que fecha actualizar el histórico

IF $(vDay) = 24 THEN

LET vDateUpdate = MonthEnd(AddMonths(Today(),-2)); //Fecha hasta donde cargar el historial

LET vDateNewUpdate = MonthStart(AddMonths(Today(),-1)); //Fecha desde donde se hace la nueva carga

ELSE

LET vDateUpdate = MonthEnd(Addmonths(Today(),-1)); //Fecha hasta donde cargar el historial

LET vDateNewUpdate = MonthStart(AddMonths(Today(),0)); //Fecha desde donde se hace la nueva carga

ENDIF

A03:

LOAD *

FROM

[..\FACTURACION_DETALLADA_CON_PAQUETE_EXT.qvd] (qvd)

Where Date(fecha_factura) <= $(vDateUpdate);

The first part works fine, but now when i load the QVD to compare with the date the result is empty.

Any suggestion.

Thanks!

Miguel_Angel_Baeyens

Hi,

vDateUpdate is a literal, so you need to use single quotes to match the format returned by the Date() function:

Where Date(fecha_factura) <= '$(vDateUpdate)';

Hope that helps.

Miguel

julruiz123
Partner - Creator
Partner - Creator
Author

Thanks! Miguel Angel