<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Editing Calculated Value Formula in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8839618#M41867</link>
    <description>&lt;P&gt;Is it possible to edit the formula of a Calculated Value in a schedule using the Revit API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Python, and I can get the Calculated Value as a ScheduleField using the code below, but I can't figure out a way to access the Formula. Perhaps this isn't possible in the API at the moment? If it is, any help would be appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;view = doc.ActiveView&lt;BR /&gt;&lt;BR /&gt;nFields = view.Definition.&lt;SPAN&gt;GetFieldCount&lt;/SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for&lt;/SPAN&gt; i &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;range&lt;/SPAN&gt;(&lt;SPAN&gt;0&lt;/SPAN&gt;, nFields):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;field = view.Definition.&lt;SPAN&gt;GetField&lt;/SPAN&gt;(i)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;if&lt;/SPAN&gt; field.IsCalculatedField:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fieldType = field.FieldType&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code gets the FieldType which is Formula, and according to this:&amp;nbsp;&lt;A href="https://www.revitapidocs.com/2017/8ea6756f-aa39-2a10-792a-c22eae32db55.htm" target="_blank" rel="noopener"&gt;https://www.revitapidocs.com/2017/8ea6756f-aa39-2a10-792a-c22eae32db55.htm&lt;/A&gt;&amp;nbsp;it is a Get and Set property. But I don't understand how to Set it or if it is even possible&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2019 19:49:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-07T19:49:03Z</dc:date>
    <item>
      <title>Editing Calculated Value Formula</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8839618#M41867</link>
      <description>&lt;P&gt;Is it possible to edit the formula of a Calculated Value in a schedule using the Revit API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Python, and I can get the Calculated Value as a ScheduleField using the code below, but I can't figure out a way to access the Formula. Perhaps this isn't possible in the API at the moment? If it is, any help would be appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;view = doc.ActiveView&lt;BR /&gt;&lt;BR /&gt;nFields = view.Definition.&lt;SPAN&gt;GetFieldCount&lt;/SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for&lt;/SPAN&gt; i &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;range&lt;/SPAN&gt;(&lt;SPAN&gt;0&lt;/SPAN&gt;, nFields):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;field = view.Definition.&lt;SPAN&gt;GetField&lt;/SPAN&gt;(i)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;if&lt;/SPAN&gt; field.IsCalculatedField:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fieldType = field.FieldType&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code gets the FieldType which is Formula, and according to this:&amp;nbsp;&lt;A href="https://www.revitapidocs.com/2017/8ea6756f-aa39-2a10-792a-c22eae32db55.htm" target="_blank" rel="noopener"&gt;https://www.revitapidocs.com/2017/8ea6756f-aa39-2a10-792a-c22eae32db55.htm&lt;/A&gt;&amp;nbsp;it is a Get and Set property. But I don't understand how to Set it or if it is even possible&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 19:49:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8839618#M41867</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-07T19:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Editing Calculated Value Formula</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8843809#M41868</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Dan,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your query.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As you say, the FieldType property is a get and set property, so it can apparently be modified.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, as far as I understand your query, you are interested in setting the formula value itself, not the field type, so that will not help.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You say you can retrieve the Calculated Value as a ScheduleField. Interestingly, the remarks on that class say:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The SchedulableField class represents a non-calculated field...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Anyway, regardless of all that, I cannot imagine that you can edit whatever is displayed by the calculated field, since, as its name implies, the value is calculated.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 06:57:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8843809#M41868</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-06-11T06:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Editing Calculated Value Formula</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8845247#M41869</link>
      <description>&lt;P&gt;I think the ScheduleField is different than the SchedulableField, where ScheduleField includes the Calculated Values, correct me if I'm wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not interested in editing the value, but rather the formula. It seems like it's not possible, however, unless there's something else I'm missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply, Jeremy.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 17:34:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8845247#M41869</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-11T17:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Editing Calculated Value Formula</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8846342#M41870</link>
      <description>&lt;P&gt;Can you edit it manually in the user interface? If not, the API will probably not support this either. If yes, there might be a way somehow. To discover how, perform the manual operation and research what exactly changed where, e.g., using RevitLookup:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-ontology.html#3" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-ontology.html#3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 06:45:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8846342#M41870</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-06-12T06:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Editing Calculated Value Formula</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8847329#M41871</link>
      <description>&lt;P&gt;Yes, it is possible to edit the formula of a calculated value as such:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Create the calculated Value&lt;/P&gt;&lt;P&gt;2. Add the formula in the Formula Field&lt;/P&gt;&lt;P&gt;3. After the value is created, you can select it in the Fields and click the pencil button to edit it. You can then edit the formula as needed in the Formula Field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to use the Revit Lookup tool on the schedule, but I couldn't find anything of use. The farthest I can get is to get the Calculated Value, but I don't know how to access the Formula in the calculated value to be able to edit it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:32:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editing-calculated-value-formula/m-p/8847329#M41871</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-12T14:32:11Z</dc:date>
    </item>
  </channel>
</rss>

