Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a file in .csv with these fields: Caller ; Recipient ; Duration.
The field "duration" is expressed in seconds (for ex: 06 , 10 ,11, 12, 13 , 24 , 31... 1000) what I need is this field in minutes.
I tried to write this the script:
LOAD
Duration,
num(Duration/60, ###.0) as DurataMinuti
FROM
but if I insert a List Box, it makes ones like this picture. I need only one 0, 1, 2 etc data.
Do you have any suggestion?
Thank you in advance.
Andrea
Hi,
It seems you don't want the fractions of minutes (seconds), so check this example. It works very similar to the above, but it all depends on how do you want to round the fractions (18 seconds has to be rounded to 1 minute or to 0 minutes?).
Hope that helps.
Miguel
Hi,
Use your local decimal separator (likely a comma) in the Num() function. That is working fine here. The Interval#() function will do as well:
Data:
LOAD *,
Interval(Interval#(Seconds, 'ss'), 'mm:ss') AS Minutes;
LOAD Ceil(Rand() * 1000) AS Seconds
AUTOGENERATE 20;
Hope that helps.
Miguel
Hi,
It seems you don't want the fractions of minutes (seconds), so check this example. It works very similar to the above, but it all depends on how do you want to round the fractions (18 seconds has to be rounded to 1 minute or to 0 minutes?).
Hope that helps.
Miguel
That works!
Thank you Miguel!
18 should be 0 minute , 31 should be 1 minute.
Hi Andy,
Then just replace the Ceil() function in the script by the Round() function (check the Reference Manual for further details on how the Round() function works and what parameters it accepts):
Round(Seconds/60) AS RoundMinutes;
Regards.
Miguel