Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

HELP! SOS! BIG trouble

i have a list of table data like this format just for an example,

Member_id

TeacherName

StartDate

StartTime

EndTime

27142753

A

2013-11

11/1/2013 1:00

11/1/2013 4:00

26966290

B

2013-11

11/1/2013 2:00

11/1/2013 12:30

27544044

C

2013-11

11/1/2013 2:00

11/1/2013 12:30

i want to subtract each slot hour between field startime and endtime into a new data columnn.

to end up it into like this ,i do not want to show the end time hour here

Member_idNameStartDateStartTimeEndTimeSlot
27142753A2013-1111/1/2013 1:0011/1/2013 4:001:00
27142753A2013-1111/1/2013 1:0011/1/2013 4:002:00
27142753A2013-1111/1/2013 1:0011/1/2013 4:003:00
26966290B2013-1111/1/2013 2:0011/1/2013 5:002:00
26966290B2013-1111/1/2013 2:0011/1/2013 5:003:00
26966290B2013-1111/1/2013 2:0011/1/2013 5:004:00
27544044C2013-1111/1/2013 6:0011/1/2013 9:006:00
27544044C2013-1111/1/2013 6:0011/1/2013 9:007:00
27544044C2013-1111/1/2013 6:0011/1/2013 9:008:00

i do not know how to do it in qlikview or SQL scrip

8 Replies
Not applicable
Author

try to use previous function

Not applicable
Author

could you elaborate more

danieloberbilli
Specialist II
Specialist II

I dont know exactly how it works but just as an idea: you need a loop in your load script in order to duplicate the IDs and with (EndTime -StartTime)-times of iterations where Slot is StartTime + Number of iteration.

rajeshvaswani77
Specialist III
Specialist III

You could use the above function.

thanks,

Rajesh Vaswani

Not applicable
Author

is that possible you give me an example

Not applicable
Author

Hi Max,

Perhaps use the IterNo() function that can iterate over each line.

See an answer in :

How to tranform table/generate data

The problem (or question) seems very similar.

Fabrice

Luis_Cortizo
Former Employee
Former Employee

Hello, Max

  The desired output for the data you have posted, would be something like this, right?

Member_idTeacherNameStartDateStartTimeEndTimeSlot
27142753A2013-1111/1/2013 1:0011/1/2013 4:001
27142753A2013-1111/1/2013 1:0011/1/2013 4:002
27142753A2013-1111/1/2013 1:0011/1/2013 4:003
26966290B2013-1111/1/2013 2:0011/1/2013 12:302
26966290B2013-1111/1/2013 2:0011/1/2013 12:303
26966290B2013-1111/1/2013 2:0011/1/2013 12:304
26966290B2013-1111/1/2013 2:0011/1/2013 12:305
26966290B2013-1111/1/2013 2:0011/1/2013 12:306
26966290B2013-1111/1/2013 2:0011/1/2013 12:307
26966290B2013-1111/1/2013 2:0011/1/2013 12:308
26966290B2013-1111/1/2013 2:0011/1/2013 12:309
26966290B2013-1111/1/2013 2:0011/1/2013 12:3010
26966290B2013-1111/1/2013 2:0011/1/2013 12:3011
27544044C2013-1111/1/2013 2:0011/1/2013 12:302
27544044C2013-1111/1/2013 2:0011/1/2013 12:303
27544044C2013-1111/1/2013 2:0011/1/2013 12:304
27544044C2013-1111/1/2013 2:0011/1/2013 12:305
27544044C2013-1111/1/2013 2:0011/1/2013 12:306
27544044C2013-1111/1/2013 2:0011/1/2013 12:307
27544044C2013-1111/1/2013 2:0011/1/2013 12:308
27544044C2013-1111/1/2013 2:0011/1/2013 12:309
27544044C2013-1111/1/2013 2:0011/1/2013 12:3010
27544044C2013-1111/1/2013 2:0011/1/2013 12:3011

Wihout taking into account that some EndTimes doesn't finish in 60 minutes (hence the 11 slot even when the EndTime is 12:30).

For this kind of solution, instead of overloading the layout level with complex calculation is quite straightforward to perform that kind of calculation on the Script layer, I have loaded your sample data on an Inline Table and performed the slot calculation on two Precendet Loads:

Data:

Load

  Member_id,

  TeacherName,

  StartDate,

  StartTime,

  EndTime,

  Hour(StartTime) + iterno()-1 as Slot

WHILE  Hour(StartTime) + iterno()-1 < Hour(EndTime);

LOAD

  num#(Member_id) as Member_id,

  TeacherName,

  StartDate,

  Timestamp#(StartTime, 'DD/M/YYYY h:mm') as StartTime,

  Timestamp#(EndTime, 'DD/M/YYYY h:mm') as EndTime;

LOAD * INLINE [

    Member_id, TeacherName, StartDate, StartTime, EndTime

    27142753, A,  2013-11, 11/1/2013 1:00, 11/1/2013 4:00

    26966290, B,  2013-11, 11/1/2013 2:00, 11/1/2013 12:30

    27544044, C,  2013-11, 11/1/2013 2:00, 11/1/2013 12:30

];

Please find attached a QlikView document example.

sudeepkm
Specialist III
Specialist III

Have you tried IntervalMatch in your load script?

You can define the slot hours in a separate table using autogenerate for 24 hours. Each row having start time and end time and the slot #.

Then the original data table can be loaded and then you can use the intervalmatch load. Please refer to the reference manual or help file for more details.