Help

Format and insert data to duration format field

Topic Labels: Extensions
Solved
Jump to Solution
813 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Nicolas_Hurtado
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello,

I’m new at scripting and have, I think, a basic question if someone can please help me.

I want automate the creation of pre-filled fields with the script app. I’ve been able to run that successfully for basic ‘text strings’. But now I’m trying to add data to a field that is formatted with ‘duration format’ and I haven’t been able to make it work.

The code I wrote was:

//Ask for session duration
var SessionDuration = await input.textAsync (‘Type the duration of this sessions’);

//Create field and fill with duration
let CrearRegistro = await ActivityTable.createRecordsAsync([
{
fields:{
“DurationField”: Number(SessionDuration),
},
}
]);

And when I input data such as 30 or 60… the field always shows 0:01.

I’ll appreciate any help… thanks.

1 Solution

Accepted Solutions
Justin_Barrett
18 - Pluto
18 - Pluto

Duration fields store their data in terms of seconds, but by default display the output as hh:mm. If you want your input value to be interpreted as minutes, multiply the input value by 60, then save that to the duration field.

See Solution in Thread

2 Replies 2
Justin_Barrett
18 - Pluto
18 - Pluto

Duration fields store their data in terms of seconds, but by default display the output as hh:mm. If you want your input value to be interpreted as minutes, multiply the input value by 60, then save that to the duration field.

Nicolas_Hurtado
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks a lot Justin… I guess its a beginners question… but I’m getting better :slightly_smiling_face: