Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create time interval selector?

Eg.

120 - 240min

240 - 360min

360 - 480min

every interval is 120min block, only 1st block is 15 - 120 min

5 Replies
swuehl
MVP
MVP

Maybe like

LOAD *,

  if( Minutes < 120, Dual('15 - 120 Mins',65),

  Dual(floor(Minutes+1,120) & ' - ' & ceil(Minutes,120) & ' Mins', (Ceil(Minutes+1,120)+floor(Minutes,120))/2 ))

                                                                      as Class;

LOAD ceil(RAND()*1000)+15 as Minutes

AutoGenerate 11000;

maxgro
MVP
MVP

load

  Min,

  if(Start=0,

  dual('min 15' & ' - ' & End, 15),

  dual('min ' & Start & ' - ' & End, Start)

  ) as TimeInterval;

load

  IterNo() as Min,

  Div(IterNo(),120)*120 as Start,

  Div(IterNo(),120)*120+120 as End

AutoGenerate 1

While IterNo() <= (24*60)

;

Not applicable
Author

thanks! it works!

Anonymous
Not applicable
Author

You can do like this as well at script level:

IF(Minutes>=15 and Minutes<120, Dual('15-120 Min',1),       //Dual() helps you in sorting

IF(Minutes>=120 and Minutes<240, Dual('120-240 Min',2),

IF(Minutes>=240 and Minutes<360, Dual('240-360 Min',3)))) as IntervalFieldName

Hope this will help!!

MarcoWedel

see also

Re: How to group mins into time interval

please don't post the How to group mins into time interval multiple times and close your open threadsby selecting correct (and possibly helpful) answers.

thank you

regards

Marco