As of 2021.01 the new WhatIf functionality is being introduced with the intention to remove the outdated WhatIf functionality by 2023. This new WhatIf functionality uses WhatIfTemplates which can be populated in the WhatIf Editor, i.e. the display to create whatif-instances that can be applied to a workflow. The connection between WhatIfs-instances and workflows is established via the IFD, the Interactive Forecasting Displays, where a <whatIfTemplateId> can be defined after the <workflowId> in the Topology.
<node id="run_whatif_properties" name="wf1 t1 Properties"> <workflowId>Test_WhatIfSettings</workflowId> <whatIfTemplateId>whatif_properties</whatIfTemplateId>....
The WhatIf Editor uses the whatifTemplates.xsd schema. This schema allows the configuration of a whatif-template, which is used in the WhatifEditor GUI to allows the specification of properties and modifiers to be applied in a whatif-instance. Multiple whatIfTemplate.xml files are supported as long as their prefix is WhatIfTemplates_....xml and no duplicate identifiers are used across the files. Identifiers defined in one xml-file can be used in another xml-file.
Properties can be specified directly (string, int, double, boolean) or by selection from an enumeration or by selection from a configuration file (e.g. moduledataset, module parameter file)
Modifiers can be specified per modifierType. The actual behaviour of the modifier depends on the setting of <whatIfModifierType> element for this modifierType in the ModifierTypes.xml:
- only apply the modifier if referenced in a whatif
- always apply the modifier (i.e. the default behaviour)
- never apply the modifier in a whatif workflow (= always apply unless running a whatif workflow)
Note: Modifiers need to be committed (i.e. non-local) to become available for application in a whatif-instance. It may therefore be useful to turn on the <autoCommit>-flag in the ModifierTypes.xml
<timeSeriesModifier id="modify_timeseries_only_applied_in_whatif" name="Modify time series (only applied in whatif)"> <whatIfModifierType>apply if referenced in what-if workflow</whatIfModifierType> <timeSeries>....
The whatIfTemplates-schema
The whatifTemplates-schema contains two main sections:
- valueTypes: to specify the kinds of properties and their limitations
- whatifTemplates: to compose which properties and modifiers can be specified in the template. whatifTemplates can be nested (but not unlimited in the GUI)
valueTypes
valueTypes define the kind of properties that can be associated to a whatIfTemplate. Each valueType has a number of attributes with at least an id (required) and an optional default value. Additional attributes depend on the valueType. By allowing multiple valueTypes of the same kind, different display behaviour can be accommodated (e.g. different min/max.ranges for numeric properties).
Attribute id refers to the identifier used to connect this value type to the property in the whatIfTemplate.
Optional attribute default refers to the default value incoporated in the whatIf-instance and shown in the display.
enumeration
The valueType enumeration results in a string-property value. The enumeration will list the items available in the dropdown box of the WhatIfEditor.
Required attribute code refers to the value which is stored when this option is chosen.
Optional attribute label refers to the Caption of this value in the display.
If no default value is defined the first item will be shown as selected value in the display.
configFile
The valueType configFile results in a string-property value refering to a moduleDataSet-file, a moduleParameterFile or a coldState-file. Based on the search pattern the Configuration (either available in the database or the file system) will be queried for items to populated the dropdown box of the WhatIfEditor.
Attribute type refers to the type of config file (i.e. module dataset, module parameter, cold state).
Attribute pattern refers to the search pattern to apply.The result will be a list of config files for the dropdown box that meets this search pattern.
Attribute hidePattern option indicates whether the pattern should be stripped from the value shown in the dropdownbox.
Attribute default refers to the default value selected and shown in the dropdown box. Be aware that the default value should account for the hidePattern option. When hidePattern is false, the default should include the full string including the search pattern. When hidePattern is true, the default value should include only the selected postfix.
<valueTypes> <configFile hidePattern="true" id="select_moduledataset" pattern="moduledataset_*" type="module dataset" default="grid_A"/> <configFile hidePattern="false" id="select_moduleparfile" pattern="moduleparfile_fixed_*" type="module parameter" default="moduleparfile_fixed_base"/>
If no default value is defined the first item will be shown as selected value in the display.
string
The valueType string allows the user to specify any string value they like in a text field.
If no default value is defined the item has an empty value in the display.
int
The valueType int allows the user to specify any string value they like in a text field.
Optional attribute min specifies the minimum value accepted in the display.
Optional attribute max specifies the maximum value accepted in the display.
double
The valueType double allows the user to specify any string value they like in a text field.
Optional attribute min specifies the minimum value accepted in the display.
Optional attribute max specifies the maximum value accepted in the display.
bool
The valueType bool allows the user to turn on/off a checkbox value.
dateTime
The valueType dateTime is not implemented yet.
whatIfTemplate
The whatIfTemplate section defines the actual whatIfTemplate shown in the display to populate specific whatIf-instances with data values.
Required attribute id refers to the identifier of the whatIfTemplate. This id can be referenced in the Topology to make the connection with a workflow where the whatif can be applied.
Required attribute name refers to the template name (i.e. caption) used in the display.
properties
Lists all properties to be defined in the whatIf and shown in the display either as text field or dropdown item dependent on the valuetype.
property
Required attribute id is the property-key as applied in the workflow
Optional attribute name is the name/caption as shown in the display.
Required attribute valueTypeId refers to one of the valueTypes defined earlier.
modifierType
Identifies the modfierType for which all available committed modifier-instances will be shown in the dropdown box. By default no modifier is selected.
Note: By selecting a modifier-instance a copy of this selected modifier is created which is tightly related to the whatif-instance. Value changes in the original modifier (resulting in a new modifier-instance) will therefore not be reflected in the whatif. To incorporate changed modifier values, the modifier-instance should be reselected in the display to obtain a copy of this new modifier-instance.
whatIfLocationSetId
Not implemented yet. This feature would allow the specification of dynamic locations that are associated to the whatif.
whatIfTemplateId
Accommodates nesting of whatIfTemplate sections to bring some structure in the display appearance.
Final note
WhatIfTemplate identifiers are stored as part of the whatif-instance, also when archived. Changing whatIfTemplate-identifiers may thus break retrieval of archived whatifs (i.e. no similar as otehr archive exchanges)