# Adding Calculated Parameter using Revit API

**URL:** <https://forum.dynamobim.com/t/adding-calculated-parameter-using-revit-api/97828>\
**Category:** Developers\
**Tags:** revit, python, dynamo, api, developers\
**Created:** [February 6, 2024, 6:15am UTC](https://forum.dynamobim.com/t/adding-calculated-parameter-using-revit-api/97828 "2024-02-06T06:15:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NIRMAL](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nirmal/32/150135_2.png) [@NIRMAL](https://forum.dynamobim.com/u/NIRMAL)\
**Post date:** [February 6, 2024, 6:15am UTC](https://forum.dynamobim.com/t/adding-calculated-parameter-using-revit-api/97828/1 "2024-02-06T06:15:07Z")

</div>

Hello,

I am having trouble adding a calculated parameter to a schedule using the Revit API.  
Attempted to create schedules using Python in Dynamo. While I successfully created a new Material Takeoff and added parameters to the schedule, I couldn’t locate a method for adding a calculated column in schedules.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/c/2c6a4333734ddf4c88c641a45dfb2806a8e82bc0.png)

```auto
desiredParams = [" ***", "Type","Material: Name", "************", "Length","Calculated Weight", "Structural Usage"]
OUT = []

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
cat = Category.GetCategory(doc, BuiltInCategory.OST_StructuralColumns)
viewSchedule = ViewSchedule.CreateMaterialTakeoff(doc, cat.Id)
definition = viewSchedule.Definition
params = [i.GetName(doc) for i in definition.GetSchedulableFields()]
schedulableFields = definition.GetSchedulableFields()
for j in desiredParams:
	if j in params:
		ind = params.IndexOf(j)
		definition.AddField(schedulableFields[ind])
		OUT.append(j + " Added")
	elif j == "Calculated Weight":
	
	else:
		OUT.append(j + " Not founds")
TransactionManager.Instance.TransactionTaskDone()

```

---

<div class="post-metadata">

**Author:** ![bharat.minocha](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/bharat.minocha/32/174524_2.png) [@bharat.minocha](https://forum.dynamobim.com/u/bharat.minocha)\
**Post date:** [February 6, 2024, 7:00am UTC](https://forum.dynamobim.com/t/adding-calculated-parameter-using-revit-api/97828/2 "2024-02-06T07:00:09Z")

</div>

hi @NIRMAL

you are on right track, here [InsertCombinedParameterField Method (revitapidocs.com)](https://www.revitapidocs.com/2023/31528702-22e7-f515-5edc-9356585e3bc1.htm) , using this method u can add the formula u looking for it takes “ScheduleFieldType” which is an Enumeration and i think this will get u to what u trying to do.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/f/fff387a1267ec7c20d6f8a39a7370c65f3ef994c.png)

Regards,  
BM

---

<div class="post-metadata">

**Author:** ![NIRMAL](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nirmal/32/150135_2.png) [@NIRMAL](https://forum.dynamobim.com/u/NIRMAL)\
**Post date:** [February 6, 2024, 8:17am UTC](https://forum.dynamobim.com/t/adding-calculated-parameter-using-revit-api/97828/3 "2024-02-06T08:17:58Z")

</div>

It is still unclear path for me.  
The method [InsertCombinedParameterField Method](https://www.revitapidocs.com/2021.1/f2303148-6e5e-d143-3725-3ac12c04ea86.htm) doesn’t do the calculation and it does not take the **ScheduleFieldType** enumeration as input

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/b/6b917c37dcaf832a7ef5c8914caa33af20762711.png)

An example of how we can use this enumeration to add a calculated field will be very helpful.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/c/ec9239ad32435f2fe29e93a629c2725f4aad5e84.png)

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [February 6, 2024, 4:25pm UTC](https://forum.dynamobim.com/t/adding-calculated-parameter-using-revit-api/97828/4 "2024-02-06T16:25:24Z")

</div>

Hi,

Unless recently changed, this is not supported by the API.

see here

> **[API - create a calculated value field in schedule](https://forums.autodesk.com/t5/revit-ideas/api-create-a-calculated-value-field-in-schedule/idi-p/8065079)**
>
> Revit API should enable creating a calculated value field in a schedule and also provide means to access and modify it (e.g. read and change the formula, name etc.). Simple as that.

---

<div class="post-metadata">

**Author:** ![bharat.minocha](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/bharat.minocha/32/174524_2.png) [@bharat.minocha](https://forum.dynamobim.com/u/bharat.minocha)\
**Post date:** [February 7, 2024, 4:19am UTC](https://forum.dynamobim.com/t/adding-calculated-parameter-using-revit-api/97828/5 "2024-02-07T04:19:24Z")

</div>

Even i was trynna achieve this using that enumeration and creating a schedulable field but no success @NIRMAL i’ll still be looking and will keep u posted here 😢
