Sum task duration from object properties

Hej community,

I have exported a revit model with shared parameters of "Task duration" with integer values representing duration in days, f.x. Task duration: 10

How do I transfer this "Task duration" value from the linked object to the task field "duration" in syncho?
In addition to this, how to sum several durations if the the task has multiple objects linked to it?

I have tried to script it using UFV, but no success, as I am not an expert in it.

Thank you for any input.

  • Petras Bagdonas
  • Nov 20 2017
  • FAQ
Company AAU
  • Nov 20, 2017

    Admin Response

    One possible way to do this is to use User Field formulas:

    1. In the User Fields window, right click to Add

    2. Set the Category to Task, Type to String and Calculation Type to Calculate

    3. Press the Edit button to open the Formula Editor

    The formula should be

    STRING(SUM(RESOURCE. UFV("Task Duration")))+"d"

    this will sum the value of the the Resource User Field of all assigned resources and convert it to a text string with a "d" at the end (for days)

    4. From the Analyse ribbon, select "Recalculate Values"

    5. Use the settings shown in the image below (labeled 5)

    6. Add the new Task User Field column to the task list

    7. Make sure no task filters are applied, then in the Gantt chart, Ctrl+A to select all

    8. Hold Ctrl then left click in the Task User Field column to select it

    9. Right click in the one of the cells of the selected column and choose "Copy Tasks as Text"

    10. Right click in the TOP cell of the Duration column and choose "Paste Tasks as Text"  this will replace the duration with the calculated values

  • Attach files
  • Petras Bagdonas commented
    November 21, 2017 08:01

    Thank you for a quick response, the process makes sense, however, I have a faced a problem.

    During the step 4, the values returned in the UF are concatenated not summed, even though the formula says SUM F.x. I have 3 resources with UFV "Task Duration" values of: 4 , 2 , 6. With your suggested formula synchro returns: 426d, not 12d (4+2+6+"d").

    I have tried deleting "d" from the formula, changing Type of UF into integer, number and of course changing the formula to calculate integer or number, but still the same issue- it returns concatenated results.
    Tried to change UFV with different names, values, etc. nothing seems to solve the problem. 

  • Admin
    Kate Hester commented
    November 21, 2017 10:47

    The imported resource User Field is likely of Type String. When the SUM() command is used on text Strings, it concatenates the strings; when it is used on numbers or integers, it adds.

    You can modify the formula to convert the String values to Integer values before summing:

    STRING(SUM(INT(RESOURCE.UFV("Task Duration"))))+"d"

  • Petras Bagdonas commented
    November 21, 2017 10:52

    Hey Kate,
    that worked!


    Thanks a lot!

  • Petras Bagdonas commented
    November 28, 2017 15:11

    Hey again,

    Now I have faced another small issue.
    If I try to sum a short duration, f.x. 2 resources with 0.2 and 0.5 values, the sum for "Resource duration" should be returned of 0.7 but calculation returns 0. I tried to add manual values,but still the same. How to fix this issue?

    Furthermore, in the "Duration" field, which is default by Synchro, I cannot add values with point values (f.x. 3.5d, 3.5h, etc.) I have tried looking into the settings sections, but couldn't find an option.

    Thank you!

  • Admin
    Kate Hester commented
    November 28, 2017 20:46

    To SUM decimal values, use FLOAT() instead of INT() in your formula. INT() chops off all decimal values and returns only whole numbers. e.g.

    STRING(SUM(FLOAT(RESOURCE.UFV("Task Duration"))))+"d"

    Synchro does not allow durations with decimal point values. You should use hours instead of days for the duration unit if you wish to schedule in partial days

    The easiest way to do this is to convert your decimal values to hours (or minutes). For example if a day has 10 hours:

    STRING(10*SUM(FLOAT(RESOURCE.UFV("Task Duration"))))+"h"

  • Petras Bagdonas commented
    November 29, 2017 08:38

    I had the exact idea to convert it to the hours and then transfer to the duration column, therefore, the FLOAT() is not required. Furthermore, if using FLOAT(), and the duration returned is 30.5h and if this value is copied to the duration column, as in step 10, the copied value is 5h. The synchro recognized only the value after the dot, but by the logic it actually should return 30h. So maybe an area to be improved in the update.