The Workflow class allows you to read and write workflow files. More...
The PRIMER JavaScript API provides many class constants, properties and methods. For Arup to
be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase
or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you
should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your
own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:
Detailed DescriptionThe Workflow class gives you simple functions to read and write workflow files |
The index of the model to return the id for.
If defined the id of the model that has data for the named workflow is returned. If it is not specified it uses the name of the workflow selected by the user from the workflow menu.
Returnsinteger Return typeNumber |
ModelUnitSystemFromIndex(model_index[integer], workflow_name (optional)[string]) [static]DescriptionReturns the unit system of a model that has data for the selected workflow by index (starting at 0). Will be Workflow.UNIT_SYSTEM_NONE or Workflow.UNIT_SYSTEM_U1 or Workflow.UNIT_SYSTEM_U2 or Workflow.UNIT_SYSTEM_U3 or Workflow.UNIT_SYSTEM_U4 or Workflow.UNIT_SYSTEM_U5 or Workflow.UNIT_SYSTEM_U6 |
The index of the model to return the unit system for.
The workflow name to return the unit system for. This is required when a PRIMER item is generated from REPORTER. If it is not specified the first workflow unit system associated with the model is returned (this is the 'normal' case where a user launches a workflow from the workflow menu).
Returnsinteger Return typeNumber |
The index of the model to return the program build number for.
The workflow name to return the build number for. This is required when a PRIMER item is generated from REPORTER. If it is not specified the build number for the first user data associated with the model is returned (this is the 'normal' case where a user launches a workflow from the workflow menu).
Returnsnumber Return typenumber |
The index of the model to return the user data for.
The workflow name to return the user data for. If it is not specified it uses the name of the workflow selected by the user from the workflow menu.
Returnsobject Return typeObject |
The index of the model to return the program name for.
The workflow name to return the program name for. This is required when a PRIMER item is generated from REPORTER. If it is not specified the program name for the first user data associated with the model is returned (this is the 'normal' case where a user launches a workflow from the workflow menu).
Returnsstring Return typeString |
The index of the model to return the program version for.
The workflow name to return the version for. This is required when a PRIMER item is generated from REPORTER. If it is not specified the version for the first user data associated with the model is returned (this is the 'normal' case where a user launches a workflow from the workflow menu).
Returnsnumber Return typenumber |
NumberOfModels(workflow_name (optional)[string]) [static]DescriptionReturns the number of models that have data for the workflow selected by the user. |
If defined the number of models that have data for the named workflow is returned. If not defined the number of models that have data for the workflow selected by the user on the workflow menu is returned
Returnsinteger Return typeNumber |
ExampleTo get the number of models that have data
var n = Workflow.NumberOfModels();
|
Refresh() [static]DescriptionScan for fresh workflow data |
No arguments
ReturnsNo return value |
Example
Workflow.Refresh();
|
WorkflowDefinitionFilename(workflow_name (optional)[string]) [static]DescriptionReturns the workflow definition filename |
The workflow name to return the workflow defintion filename for. If it is not specified it uses the name of the workflow selected by the user from the workflow menu.
Returnsstring Return typeString |
ExampleTo get the worklow definition filename that the script has been run with
var workflow_definition_filename = Workflow.WorkflowDefinitionFilename();
|
Object containing user data required for the workflow.
Filename to write to.
Filename of the workflow definition file.
Extra workflow information
Object has the following properties:
| Name | Type | Description |
| model_unit_system (optional) | integer | The model unit system. Can be Workflow.UNIT_SYSTEM_NONE or Workflow.UNIT_SYSTEM_U1 or Workflow.UNIT_SYSTEM_U2 or Workflow.UNIT_SYSTEM_U3 or Workflow.UNIT_SYSTEM_U4 or Workflow.UNIT_SYSTEM_U5 or Workflow.UNIT_SYSTEM_U6 |
ReturnsNo return value |
WriteToModel(user_data[object], model[Model], workflow_definition_filename[string], extra (optional)[object]) [static]DescriptionWrites a workflow to a model (updating it if it already exists) |
Object containing user data required for the workflow.
Model to write to.
Filename of the workflow definition file.
Extra workflow information
Object has the following properties:
| Name | Type | Description |
| model_unit_system (optional) | integer | The model unit system. Can be Workflow.UNIT_SYSTEM_NONE or Workflow.UNIT_SYSTEM_U1 or Workflow.UNIT_SYSTEM_U2 or Workflow.UNIT_SYSTEM_U3 or Workflow.UNIT_SYSTEM_U4 or Workflow.UNIT_SYSTEM_U5 or Workflow.UNIT_SYSTEM_U6 |
ReturnsNo return value |