Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
how to dynamically create the time slots based on user preference.
Eg:
15mins,30 min, 1hr,1day -> should be the possible values for selection.
Hi
You can use Class to create a calculated dimension with a variable interval. See the attached qvw.
This script creates some data:
Intervals:
LOAD IntervalName, Evaluate(%Interval) As %Interval Inline
[
IntervalName, %Interval
15 mins, 15/1440
30 mins, 30/1440
1 hour, 1/24
12 hours, 1/2
1 day, 1
2 days, 2
];
Data:
LOAD * Inline
[
Time, Value
2013/07/31 08:00:00, 11
2013/07/31 08:05:00, 20
2013/07/31 08:20:00, 8
2013/07/31 09:00:00, 20
2013/07/31 09:01:00, 40
2013/07/31 09:25:00, 10
2013/07/31 11:10:00, 15
2013/07/31 15:10:00, 16
2013/07/31 15:50:00, 6
2013/08/01 07:45:00, 13
2013/08/01 09:00:00, 18
2013/08/02 08:10:00, 16
2013/08/02 08:10:00, 22
];
Create a list box for IntervalName. Create a chart with the dimension:
Timestamp(Class(Time, %Interval), 'YYYY/MM/DD hh:mm')
and the expression:
Sum(Value)
Now select different intervals to see the values summed for the specified intervals.
Hope that helps
Jonathan
Edit: corrected expression in first inline load (had 2440 minutes per day instead of 1440!!)
Look at the calendar script provided by QlikView Components made by RobWunderlich here (Best practice scripts for common tasks)
qlikview-components - A script library for Qlikview development - Google Project Hosting
hi,
I had tried this. But Timestamp(Class(Time, %Interval), 'YYYY/MM/DD hh:mm') is not giving any value
Hi,
Try to change your script for Date format and time format which is same as Jonathan's example. For me it's working fine.
ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='$#,##0.00;($#,##0.00)';
SET TimeFormat='h:mm:ss TT';
SET DateFormat='YYYY/MM/DD';
SET TimestampFormat='YYYY/MM/DD hh:mm:ss[.fff] TT';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
Intervals:
LOAD IntervalName, Evaluate(%Interval) As %Interval Inline
[
IntervalName, %Interval
15 mins, 15/1440
30 mins, 30/1440
1 hour, 1/24
12 hours, 1/2
1 day, 1
2 days, 2
];
Data:
LOAD * inline
[
Time, Value
2013/07/31 08:00:00, 11
2013/07/31 08:05:00, 20
2013/07/31 08:20:00, 8
2013/07/31 09:00:00, 20
2013/07/31 09:01:00, 40
2013/07/31 09:25:00, 10
2013/07/31 11:10:00, 15
2013/07/31 15:10:00, 16
2013/07/31 15:50:00, 6
2013/08/01 07:45:00, 13
2013/08/01 09:00:00, 18
2013/08/02 08:10:00, 16
2013/08/02 08:10:00, 22
];
let me know if this requires any changes.
Hi,
Try to change your formats as below:
SET TimeFormat='hh:mm:ss';
SET TimestampFormat='YYYY/MM/DD hh:mm:ss[.fff] TT';
hi ,
I tried the changes.
But i am getting null for
Timestamp(Class(Time, %Interval), 'YYYY/MM/DD hh:mm')
Hi,
Is it possible to attach your application?
sorry.. but i am not able to attach it
Hi
This expression (Timestamp(Class(Time, %Interval), 'YYYY/MM/DD hh:mm'))assumes that you have selected one IntervalName value. If nothing is selected, it will not work.
Regards
Jonathan