Share
 
 

Using a script to control export of data

The Open Data Export Centre allows data to be exported from InfoWorks WS Pro to a variety of formats. Scripts may be used to refined the export process.

Export scripts can be written using VBScript. It may help to look up VBScript Tutorial or VBScript Reference on the Internet for full details of what you can do in VBScript. Please remember that VBScript is not the same as Visual Basic, Visual Basic.NET, VBScript.NET, or Visual Basic For Applications.

The script mechanism for export is different from the script mechanism for imports. You can export the value of a VBScript function as a separate field by selecting VBScript in the Field Type column and then entering the name of a function defined in the script file in the Details column. Functions in the script file should be declared as public functions with no arguments. The return value from the function is set by assigning the return value to the name of the function. See the examples below.

The only method callable in InfoWorks WS Pro is Exporter.Field. This takes one parameter which is the name of the field and returns the value of that field. This has the same flexibility as the fields in the normal fields list, so joined fields are available.

Here are some very simple example functions. You can use all the normal functionality available in VBScript to manipulate the retrieved data before returning a value.

Public Function MyNodeID
MyNodeID = Exporter.Field("node_id")
End Function
Public Function MyX
MyX = Exporter.Field("x")
End Function
Public Function MySimVolume
MySimVolume = Exporter.Field("sim.volume")
End Function
Public Function MyGroundLevel
MyGroundLevel = Exporter.Field("ground_level")+0.11111111
End Function
Note: The VBScript component is no longer installed as part of the InfoWorks WS Pro installation. It is installed with Windows 10 and 11. In the future, Microsoft may make this an optional component but it may be switched on using the Optional Features in Windows.

Was this information helpful?