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: 
upaliwije
Creator II
Creator II

Hour in Master calender

Hi

LOAD

   Hour(LOSS_DATE) AS LOSS_HOUR,

    Day(LOSS_DATE) AS LOSS_DAY,

    Date(LOSS_DATE) AS LOSS_DATE,

    Week(LOSS_DATE) AS LOSS_WEEK,

    Year(LOSS_DATE) AS LOSS_YEAR,

    Month(LOSS_DATE) As LOSS_MONTH,

    Month(LOSS_DATE) &'-'& week(LOSS_DATE) As Month_Week;

  Load Date(LOSS_MinDate + IterNo() -1 ) AS LOSS_DATE While (LOSS_MinDate + IterNo() - 1) <= Num(LOSS_MaxDate);

Load

    Min(LOSS_DATE) AS LOSS_MinDate,

    Max(LOSS_DATE) AS LOSS_MaxDate  

RESIDENT Claim;

My above master calender script is working fine except this part Hour(LOSS_DATE) AS LOSS_HOUR

Hour is returned as 0 from the above script. Pls correct me

7 Replies
MK_QSL
MVP
MVP

How you want Hour in calendar..?

i.e. each day should be shown as 24 hour ...

like

29/07/2014 10:00

29/07/2014 11:00

29/07/2014 12:00

29/07/2014 13:00

29/07/2014 14:00.....?

upaliwije
Creator II
Creator II
Author

Yes I want to show all 24 hours for each date

tobias_klett
Partner - Creator II
Partner - Creator II

Hi,

what is the format of the LOSS_DATE?
does it have only date or also time.
Speaking in the number below the date, the time information are found in the decimals.
Show =num(LOSS_DATE) to check.
E.g 41488 is only a date and 41488.5 is at noon on this date.

Hope this helps

MK_QSL
MVP
MVP

Use something like below.... Change the Min and Max Date accordingly...

===========

Temp:

Load * Inline

[

  Date

  01/06/2014

  03/06/2014

];

MinMaxDate:

Load

  Min(Date) as MinDate,

  Max(Date) as MaxDate

Resident Temp;

Let vMinDate = NUM(PEEK('MinDate',0,'MinMaxDate'));

Let vMaxDate = NUM(PEEK('MaxDate',0,'MinMaxDate'));

Let vIter = vMaxDate - vMinDate;

Drop Table MinMaxDate;

For i = 0 to $(vIter)

  Let vDate = vMinDate + $(i);

  Calendar:

  Load

  Date ('$(vDate)') as Date,

  Day ('$(vDate)') as Day,

  Week ('$(vDate)') as Week,

  Month ('$(vDate)') as Month,

  Year ('$(vDate)') as Year,

  Timestamp('$(vDate)' + (RecNo()/24) + (IterNo())) as DateTimeStampEachHour

  AutoGenerate 24;

Next i

=======================

upaliwije
Creator II
Creator II
Author

my loss_date format is as follows

6/18/2012 11:01
6/17/2012 10:35
7/18/2012 10:12
8/14/2012 9:44
tobias_klett
Partner - Creator II
Partner - Creator II

put loss_Date in a listbox and add an expression on the expression tab of the list box and write hour(loss_date). Just to check if it works in the application. Then it should work in the script as well.

Otherwise consider to use the script of manish to create your master calendar.

its_anandrjs

Did you try hour format for the hour like

Hour(LOSS_DATE,'hh') AS LOSS_HOUR