Update Computed Fields in Data Standard

Use events in the code to create and monitor Data Standard fields that are in certain relation to other fields or to defined functions.

Fields can be updated not just when Data Standard starts, but each time the user changes selected fields.

Some functions get called exactly one time when the UI is built the first time (as with the InitializeWindow function for example). But if you want to refresh a control bound to a PowerShell function, you can do this by:

Example Code for Creating and Monitoring Data Standard Fields

In the following example, lines of code are added to the existing function InitializeWindow.
Note: For the purposes of this example, the 1 file located at C:\ProgramData\Autodesk\Vault <release>\Extensions\DataStandard\CAD\addins is used.
function InitializeWindow {

     $dsWindow.Width = 600

     $dsWindow.Height = 400

     $Prop["State"].add_PropertyChanged({

      param( $parameter)

      StateChanged

      })

}

The event is caught and the function StateChanged is called. The property "State" is bound to a textfield (testtextfield). Now each time the user inserts some new text in this field, the function StateChanged is called. Another simple function (SayHello) can be used to write a result ("Hello"+ string entered) in another field (testtextfield2). These two functions can be written like this:

The xaml file has two text-fields with the name "testtextfield" and "testtextfield2". The first one is bound by a property called "State".

Now when you start Data Standard and write something in the "testtextfield", Data Standard shows as hello+ the text that you wrote. This is just a simple example but it hopefully provides some ideas for adding new features to the Data Standard dialog or helps you address any problems.

1 Default.ps1