Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm looking for a way to group gamers by game duration time.
in my script I have a calculate field 'GameDuration' :
Date(EndTime - StartTime, 'hh:mm:ss') as GameDuration
my groups calculated in the same load statement :
if( GameDuration <'00:03:00','0-3',If(GameDuratione >='00:03:00' and GameDuratione <'00:06:00','3-6','6+')) as DurationGroup
I get all kind of errors..
any ideas??
Hi,
Did you copy past the expression from your script?
if( GameDuration <'00:03:00','0-3',If(GameDuratione >='00:03:00' and GameDuratione <'00:06:00','3-6','6+')) as DurationGroup
Change to
if( GameDuration <'00:03:00','0-3',If(GameDuration >='00:03:00' and GameDuration <'00:06:00','3-6','6+')) as DurationGroup
Also if you are writing this in the same load statement it would not work as GameDuration would not be available. You either need to reload the table or subsitute GameDuration with the formula some thing like:
if( (Date(EndTime - StartTime, 'hh:mm:ss')) < '00:03:00','0-3',If((Date(EndTime - StartTime, 'hh:mm:ss')) >= '00:03:00' and (Date(EndTime - StartTime, 'hh:mm:ss')) < '00:06:00','3-6','6+')) as DurationGroup
Regards
RL
How and where do you want to define your groups? The answer affects which solution to choose...
A couple of tips:
HIC
Hi Ilan, Time and date funcions returns a number (with an string interpretation), if you want to compare in minutes you can declare a variable with the value of a minute and use it in the 'if' comparison:
LET vsMinute = Replace(1/1440, ',', '.'); //For me ',' is dec separator, to compare in if I need to change to '.'
if( GameDuration <$(vsMinute)*3,'0-3',If(GameDuratione >=$(vsMinute)*3 and GameDuratione <$(vsMinute)*6,'3-6','6+')) as DurationGroup
Hi,
Did you copy past the expression from your script?
if( GameDuration <'00:03:00','0-3',If(GameDuratione >='00:03:00' and GameDuratione <'00:06:00','3-6','6+')) as DurationGroup
Change to
if( GameDuration <'00:03:00','0-3',If(GameDuration >='00:03:00' and GameDuration <'00:06:00','3-6','6+')) as DurationGroup
Also if you are writing this in the same load statement it would not work as GameDuration would not be available. You either need to reload the table or subsitute GameDuration with the formula some thing like:
if( (Date(EndTime - StartTime, 'hh:mm:ss')) < '00:03:00','0-3',If((Date(EndTime - StartTime, 'hh:mm:ss')) >= '00:03:00' and (Date(EndTime - StartTime, 'hh:mm:ss')) < '00:06:00','3-6','6+')) as DurationGroup
Regards
RL
Hi,
If you are creating GameDuration in same load statement and in same load statement you are using GameDuration Field It wont work.
For using this newly created field you have to use resident load.
For Example:
Test:
Load *
Interval(EndTime - StartTime,'hh:mm:ss') as GameDuration
from tableName;
Final:
Load *
if(GameDuration<'00:03:00','0 - 3 Min', if(GameDuration>='00:03:00' and GameDuration>='00:06:00'),'0 - 6 Min ','6 +')) as DurationGroup
Resident Test;
Drop table Test;
Note: Also Read Bucket article written by Henric, It will help you.
Regards
Thank you.