Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

julruiz123
Contributor

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!

Tags (2)
1 Solution

Accepted Solutions

Re: Problem to get the day from date

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

5 Replies
Not applicable

Problem to get the day from date

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 $.

Problem to get the day from date

Hi,

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

LET vDate = Day(Today());

Hope that helps.

Miguel

julruiz123
Contributor

Problem to get the day from date

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!

Re: Problem to get the day from date

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
Contributor

Problem to get the day from date

Thanks! Miguel Angel