Initial Value of Duration Type Column

Hi I am looking to set the Initial Value of a duration column called [Time Allotted]. The initial value formula would be based on the number of people selected in the [Resource] column. 1 person selected, [Time Allotted]= 2 hours, 2 people selected, [Time Allotted]=1 hour, 3 people selected, [Time Allotted] 30 mins etcโ€ฆ

Could anyone suggest how to address this problem?

Many thanks.

Maurice.

Solved Solved
0 13 419
1 ACCEPTED SOLUTION

Perhaps something like:

CONCATENATE(
  FLOOR([minutes] / 60),
  ":",
  RIGHT(("00" & MOD([minutes], 60)), 2),
  ":00"
)

View solution in original post

13 REPLIES 13

Do you mean 40 minutes here? Which would be 120 minutes divided by number of people.

Hi @Marc_Dillon

Turns out I was not provided with all information. It seems you are correct with your observation. The [Time Alloted] starting point is actually 8 Hours for 1 person to process 100 products. 2 people 4 hours, 3 people 2.66 hours etcโ€ฆ

What I need to do first is work out the total [Time Alloted] based on the [Quantity] of products e.g. if I have a quantity of 150 the first part of my formula, I think, needs to be 150/100 * 8 to get the total [Time Alloted] for 1 person. I then need to divide that number by the COUNT() of the [Resource] list to get the actual [Time Alloted] for this piece of work.

I hope this helps clarify a little.

Iโ€™m still thinking on if there is some smart way to do this better. But I can at least suggest for you to build the duration string up with concatenation, for now. Start by calculating time allotted in minutes.

time allotted minutes =

([Quantity]/100 * 8 * 60) / COUNT( [Resource] )

Then build the duration string for [Time Allotted]

โ€œ00โ€&
FLOOR( [time allotted minutes] / 60 ) &
โ€œ:โ€ &
MOD( [time allotted minutes] , 60 ) &
โ€œ:00โ€

Thank you @Marc_Dillon

Should I just create [Time Alloted Minutes] as VC?

You can. Putting in another real column would be better performance-wise for the app though.

This appears to be working as suggested @Marc_Dillon

Thank you.

Hi @Marc_Dillon

The duration value is throwing a validation error in a scenario where [Quantity] = 50 and I add 2 [Resource]s from the EnumList. Image shows how the format of the initial value in this instance.

Could you advise? Many thanks.

The minutes section needs to have 2 digits, so โ€œ2:00:00โ€. You probably need to add some logic into the expression to handle this and add an extrA โ€œ0โ€ when the minutes value is less than 10.

Hi

I have tried to solve this issue with
IFS([Department]=โ€œPOLEโ€,
CONCATENATE(
โ€œ00โ€,
FLOOR( [Time Alloted Minutes] / 60 ),
โ€œ:โ€ ,
IF(MINUTE([Time Alloted])<10,CONCATENATE(โ€œ0โ€,MOD( [Time Alloted Minutes] , 60 )),
MOD( [Time Alloted Minutes] , 60 )),
โ€œ:00โ€
))

which seems to work if the minutes value is less than 10 but if it is greater than 10 I am getting 3:026:00

Am I on the right track?

Many thanks.

I think for a duration to be valid it had to be in this format:

hhh:mm:ss

hh:mm:ss I believe appsheet interprets as a time not a duration

Perhaps something like:

CONCATENATE(
  FLOOR([minutes] / 60),
  ":",
  RIGHT(("00" & MOD([minutes], 60)), 2),
  ":00"
)

Thanks so much @Steve. Any test i have done seems to be working perfectly.

120/2^number of people-1? (halves for every person added)
If you are looking the count of people this COUNT([Resource]) should work so long as resource is itself a list. If Resource is some other column type might need a bit of a different formula.

Top Labels in this Space