Hi! MAQL question: Is there a way I can produce a...
# gooddata-platform
p
Hi! MAQL question: Is there a way I can produce a TIME string in the format HH:mm from an integer number of minutes? Generally I cast summed minutes to TIME string in the following fashion:
Copy code
CAST(TIME(CAST(FLOOR(SUM(minutes) / 60) AS INT64), MOD(SUM(minutes), 60), 0) AS STRING)

-- OR 

CAST(CAST(FLOOR(SUM(minutes) / 60) AS INT64) AS STRING) || ':' || CAST(MOD(SUM(minutes), 60), 0) AS STRING)
I couldn't find string operators or MOD operator in MAQL. I may just have missed them 😅 Thanks!
1
j
Hello Philippe. Would this section be helpful? https://help.gooddata.com/doc/enterprise/en/dashboards-and-insights/formatting-numbers-in-insights - Search for Unit Conversion in Formatting Metrics
Copy code
Format blocks can be parameterized in the following way:

div - the argument that divides the input number.
mod - the modulo calculated from the result of the div calculation.

--
{{{86400||#}}} days\, {{{3600|24|00}}}:{{{60|60|00}}}:{{{|60.|00.000}}} hours

Gives the following results

120523.521	1 days, 09:28:43.521 hours
34123.521	0 days, 09:28:43.521 hours
1
p
Hey Jan! Yes it does. Superb! I formatted my metric using the following format:
Copy code
{{{60||0}}}h {{{|60|00}}}min
Thanks!
🙌 1
j
Great 🙂