Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

aashish591
New Contributor II

how to create records from startdate and enddate

Hi All,

I have startdate and enddate for every record in a table. i want to create all the dates between start and enddate.

suppose if i have data like this:

ID
Start DateEnd Date
1001/01/201305/01/2013
6703/02/201308/02/2013

Result output:

IDDATE
1001/01/2013
1002/01/2013
100301/2013
1004/01/2013
1005/01/2013
6703/02/2013
6704/02/2013
6705/02/2013
6706/02/2013
6707/02/2013
6708/02/2013

Please help me to get this result.

Thanks

Aashish

1 Solution

Accepted Solutions
sushil353
Honored Contributor II

Re: how to create records from startdate and enddate

Try this:

temp:

LOAD * Inline

[
ID,StartDate,EndDate
10,01/01/2013,05/01/2013
67,03/02/2013,08/02/2013
]
;

Result:

LOAD ID, date(StartDate+ IterNo()-1) as DATE_Value

Resident temp

while StartDate+ IterNo() -1 <= EndDate;

HTH

Sushil

2 Replies
fernando_tonial
Valued Contributor

Re: how to create records from startdate and enddate

Hi, use the intervalmatch

intervalmatch (matchfield)(loadstatement | selectstatement )

LogPedido:

LOAD * INLINE [

    Inicio, Termino, Pedido

    01:00, 03:35, A

    02:30, 07:58, B

    03:04, 10:27, C

    07:23,  11:43, D

];

LogEvento:

LOAD * INLINE [

    Hora, Evento, Comentário

    00:00, 0, Início do Turno 1

    01:18, 1, Interrupção na Linha

    02:23, 2, Reinício da Linha com 50%

    04:15, 3, Velocidade da Linha a 100%

    08:00, 4, Início do turno 2

    11:43, 5, Fim da produção

];

Tabela_Intervalo:

IntervalMatch (Hora) Load

    Inicio,

    Termino

Resident LogPedido;

Best Regards.

Tonial.

sushil353
Honored Contributor II

Re: how to create records from startdate and enddate

Try this:

temp:

LOAD * Inline

[
ID,StartDate,EndDate
10,01/01/2013,05/01/2013
67,03/02/2013,08/02/2013
]
;

Result:

LOAD ID, date(StartDate+ IterNo()-1) as DATE_Value

Resident temp

while StartDate+ IterNo() -1 <= EndDate;

HTH

Sushil

Community Browser