Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading Data/Script: Split daterange in single date items (lines)

Hi everybody,

another question:

I have to load data via script:

LOAD

     Id,

     Website,

     Event,

     Startdate,

     Enddate

FROM

     ...

You can see that there is a start- and enddate for every event in this table.

Take a look at the table (example):

IdWebsiteEventStartdateEnddate
1000gulp.comProduct Roadshow2011/05/032011/05/06
1001heise.deRelease 0.92011/08/302011/09/02

I need to get ONE line for every single date. Is there a possibility to do this while running the import script (data reload script)?

I need a imported table in a structure like this (added a new column "Date"):

IdWebsiteEventStartdateEnddateDate
1000gulp.comProduct Roadshow2011/05/032011/05/062011/05/03
1000gulp.comProduct Roadshow2011/05/032011/05/062011/05/04
..................
1000gulp.comProduct Roadshow2011/05/032011/05/062011/05/06
1001heise.deRelease 0.92011/08/302011/09/022011/08/30
..................
1001heise.deRelease 0.92011/08/302011/09/022011/09/02

Thanks for every idea!

jup

1 Solution

Accepted Solutions
gandalfgray
Specialist II
Specialist II

Hi

I would not recommend IntervalMatch.

Try this instead

// Setting upp some testdata

WebEvent:

LOAD * INLINE [

    Id, Website, Event, Startdate, Enddate

    1000, gulp.com, Product Roadshow, 2011/05/03, 2011/05/06

    1001, heise.de, Release 0.9, 2011/08/30, 2011/09/02

];

// Here is the actual code to use:

Left Join(WebEvent)

LOAD Id,

    Date(Startdate+iterno()-1) as Date

resident WebEvent

while iterno() <= num(Enddate)-num(Startdate)+1;

hth/gg

View solution in original post

3 Replies
SunilChauhan
Champion
Champion

use Intervalmatch

Sunil Chauhan
gandalfgray
Specialist II
Specialist II

Hi

I would not recommend IntervalMatch.

Try this instead

// Setting upp some testdata

WebEvent:

LOAD * INLINE [

    Id, Website, Event, Startdate, Enddate

    1000, gulp.com, Product Roadshow, 2011/05/03, 2011/05/06

    1001, heise.de, Release 0.9, 2011/08/30, 2011/09/02

];

// Here is the actual code to use:

Left Join(WebEvent)

LOAD Id,

    Date(Startdate+iterno()-1) as Date

resident WebEvent

while iterno() <= num(Enddate)-num(Startdate)+1;

hth/gg

Not applicable
Author

Perfect - it works!

Great job!

Many thanks!

jup