i4designer Knowledgebase

Utilities

Abstract

Check out these articles and learn more details about the i4designer Utilities components and how to use them in your projects.

The components under the Utility category provides the user with various option to manipulate signal values by means of script definitions. Each component will be described in the upcoming sections of this article.

Local script
Abstract

Check out this article and learn more details about the i4designer Local script component and how can you use them in your projects.

The i4designer Local script is a utility component that enables usage of temporary signals inside a client session, also known as Client-side signals.

The Client-side signals have multiple purposes, from simple things such as supporting state switching, based on client actions (ex. going in/out of a “selected” state when clicking on a button) to more complex scenarios:

  • Multiplexing/demultiplexing array signal values

  • Providing aggregated values as signals (ex. average/min/max value of log values over a certain time window)

  • Providing client-side scripting (client vchannel functionality)

Given the fact that Client-side Signals only exist in the client application and have a lifetime that is directly related to the session lifetime, there is no security concept around them. Client-side Signals can be written or read from any component.

Client-side signals are identified by the case sensitive prefix: "local://". When the connector is requested such a signal, will be registered internally but it will not include the list of signals that are registered with the server.

The picture below illustrates the general behaviour of the Local script component:

Local_script_behaviour.jpg

Representation of the Local script behaviour

The Local script component can be found under the Utilities category:

Local_script.jpg

The Local script component

Category

Property

Description

Common

Object ID

Sets the Object ID of the component. By defining an object ID for the control, it can be passed as SignalPrefix when using parameter passing in navigation. The value of the Object ID can be used via a placeholder [OID] in other properties of this extension. The placeholder is supported in all signal properties, symbolic text and states.

Example: Setpoint [OID]

Object_ID.jpg

Signal

Input signal name

The input signal that contains array values.

Input_signal_name.jpg

Output signal name

The name of the signal to which the ouput will be written. If left empty, no writing will occur.

Output_signal_name.jpg

Configuration

Is async

If set to true, the function must return a Promise and it will be evaluated asynchronously. This allows to perform asynchronous operations (such as writing for the connector to perform an operation) and then writing the output value.

Is_async.jpg

Script body

The JavaScript function body that will process the inputs. The function will receive three parameters that can be used in the script:

  • values – an object which maps the signal name to a value (ex. values[“Local Second”]returns the current value of the local second)

  • valuesArray – an array which contains the values of each signal from the InputSignalNames in the same order (ex. valuesArray[0] contains the value of the InputSignalNames[0] signal)

  • signalService – the signal service instance which can be used in the script to gain full access to the signal operations.

The value returned by the function will be written to the OutputSignalName, if provided.

Script_body.jpg

Transform

Width

Sets the width of the component using the up and down arrows to increase and decrease, or by manually typing the desired pixels value.

The component width can also be adjusted directly on the design surface by means of mouse manipulation.

Control_width.jpg

Height

Sets the height of the component using the up and down arrows to increase and decrease, or by manually typing the desired pixels value.

The component height can also be adjusted directly on the design surface by means of mouse manipulation.

Control_height.jpg

Angle

Sets the rotation angle using the up and down arrows to increase and decrease, or by manually typing the desired degree value.

The component angle can also be adjusted directly on the design surface by means of mouse manipulation.

Angle.jpg

Left

Specifies the X (horizontal) coordinate of the component, on the grid, using the up and down arrows to increase and decrease, or by manually typing the desired value.

The component X coordinate can also be adjusted directly on the design surface by means of mouse manipulation.

Left.jpg

Top

Specifies the Y (vertical) coordinate of the component, on the grid, using the up and down arrows to increase and decrease, or by manually typing the desired value.

The component Y coordinate can also be adjusted directly on the design surface by means of mouse manipulation.

Top.jpg
Local array splitter
Abstract

Check out this article and learn how to use the Local array splitter component in order to break elements of a Signal.

The i4designer Local array splitter component is an utility component that allows the i4designer components to interact with individual array values in a simple and straightforward way.

The picture below illustrates the general behaviour of the Local array splitter component:

Behaviour_of_Local_array_splitter.jpg

Representation of the Local array splitter behaviour

The Local array splitter component can be found under the Utilities category:

Local_array_splitter_component.jpg

The Local array component

Category

Property

Description

Configuration

Array max size

If set, it will limit the number of signals for each array element. If not set, it will add signals as the array values are read and the array grows in size. Once signals are allocated, they will not be released unless the entire component is released. It is recommended to set this value if possible, otherwise large numbers of signals can be created if the signals can be created if the input signal value contains a large number of items.

Array_max_size.jpg

Array min size

If set, it will force the array to have a minimum size. This is useful for pre-creating local signals and it is also used when writing back the value to generate the array.

Array_min_size.jpg

Array name template

The name template used for creating the local signals. The local signals will automatically have the ‘local://’ prefix and it should not be specified in the template. Two placeholders can be used in the name template.

{InputSignalName}{Index}

  • InputSiganlName - the name of the signal specified as input

  • Index - the index of the value in the array (1-based)

Array_name_template.jpg

Array value type

The type of values that the array contains, If multiple value types can be in the array, then it should be set to "String". This is used for parsing the values and providing a native representation in the local signals, as well as for formatting them when writing to the output.

Array_value_type.jpg

Input array element quote

The quote character used around each array element. By default the " (double quotation mark) character is applied.

Input_aray_element_quote.jpg

Input array element separator

The separator used between array elements. By default the , (comma) character is applied.

Input_aray_element_separator.jpg

Input array left delimiter

The left array delimiter used for parsing string arrays. By default the [ (square open bracket) character is applied.

Input_array_left_delimiter.jpg

Input array right delimiter

The right array delimiter used for parsing string arrays. By default the ] (square closed bracket) character is applied.

Input_array_right_delimiter.jpg

Input array strip whitespace

If set to true, the parser will strip any whitespace between array elements and at the beginning and end of array. If false, no stripping will be done inside the element quotes if they are defined, regardless of the value of this property.

Input_array_strip_whitespace.jpg

Input array type

Describes how the input array will be written:

  • Native - the component expects the signal value to be an actual array.

  • String - the component will parse the string signal value and will try to extract the array value out of it.

Input_array_type.jpg

Output array element quote

The quote character used around each array element. By default the " (double quotation mark) character is applied.

Output_array_element_quote.jpg

Output array element separator

The separator used between array elements. By default the , (comma) character is applied.

Output_array_element_separator.jpg

Output array left delimiter

The left array delimiter used for parsing string arrays. By default the [ (square open bracket) character is applied.

Output_aray_left_delimiter.jpg

Output array right delimiter

The right array delimiter used for parsing string arrays. By default the ] (square closed bracket) character is applied.

Output_array_right_delimiter.jpg

Output array type

Describes how the output array will be written:

  • Native - the component expects the signal value to be an actual array.

  • String - the component will parse the string signal value and will try to extract the array value out of it.

Output_array_type.jpg

Output keep nulls

If set to true, null values will be written to the array, otherwise only non-null values will be written.

Output_keep_nulls.jpg

Output write buffering interval

The number of milliseconds used in Debounced/Sample/Throttle modes.

Output_write_buffer_interval.jpg

Output write buffering mode

Describes how the writing to the output signal is done:

  • None –as soon as a new value is written into one of the local signals, the whole array will be written to the output

  • Debounced –after the OutputWriteBufferingInterval time elapses from the last change to anyof the local signals, the value is written

  • Sampled –every OutputWriteBufferingInterval milliseconds, the value will be written, independent if the values have changed or not

  • Throttle –after the first change it will write the value after a maximum of OutputWriteBufferingInterval milliseconds. It will stop as soon as there are no more changes and the interval elapses.

  • WaitAll –waits until all local signals corresponding to array elements are written to and then writes the output.

  • Triggered –waits untilthe signalwith theOutputWriteTriggerSignalNamechanges it’s value

Output_write_buffering_mode.jpg

Output write trigger signal name

If set and the OutputWriteBufferingMode is set to Triggered, it will trigger a write every time it’s value changes.

Output_write_trigger_signal_name.jpg

Undefined default value

Default value used when UndefinedValueHanding is set to UseDefaultValue. The default value is parsed/formatted according to the value of the ArrayValueType property.

Undefined_default_value.jpg

Undefined value handling

Default value used when UndefinedvalueHandling is set to UseDefaultvalue. The default value is parsed / formatted according to the value of the ArrayValueType property.

  • UseNull -signal values without a defined value will be treated as nulls when written to the output

  • UseDefaultValue –signal values without a defined value will be replaced with the DefaultValue

Undefined_value_handling.jpg

Write on read

If set to true, then every time the input value changes, it will go through the entire pipelineand write to the output.

Write_on_read.jpg

Signal

Input signal name

The input signal that contains array values.

Input_signal_name.jpg

Output signal name

The name of the signal to which the ouput will be written. If left empty, no writing will occur.

Output_signal_name.jpg

Common

Object ID

Sets the Object ID of the component. By defining an object ID for the control, it can be passed as SignalPrefix when using parameter passing in navigation. The value of the Object ID can be used via a placeholder [OID] in other properties of this extension. The placeholder is supported in all signal properties, symbolic text and states.

Example: Setpoint [OID]

Object_ID.jpg

Transform

Width

Sets the width of the component using the up and down arrows to increase and decrease, or by manually typing the desired pixels value.

The component width can also be adjusted directly on the design surface by means of mouse manipulation.

Control_width.jpg

Height

Sets the height of the component using the up and down arrows to increase and decrease, or by manually typing the desired pixels value.

The component height can also be adjusted directly on the design surface by means of mouse manipulation.

Control_height.jpg

Angle

Sets the rotation angle using the up and down arrows to increase and decrease, or by manually typing the desired degree value.

The component angle can also be adjusted directly on the design surface by means of mouse manipulation.

Angle.jpg

Left

Specifies the X (horizontal) coordinate of the component, on the grid, using the up and down arrows to increase and decrease, or by manually typing the desired value.

The component X coordinate can also be adjusted directly on the design surface by means of mouse manipulation.

Left.jpg

Top

Specifies the Y (vertical) coordinate of the component, on the grid, using the up and down arrows to increase and decrease, or by manually typing the desired value.

The component Y coordinate can also be adjusted directly on the design surface by means of mouse manipulation.

Top.jpg