Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

SignedWrite()

  • Last UpdatedJan 16, 2025
  • 5 minute read

Performs a write to an AutomationObject attribute that has a Secured Write or Verified Write security classification.

Note: SignedWrite() is currently supported only for InTouch HMI applications.

Category

Miscellaneous

Syntax

int SignedWrite(string Attribute,

object Value,

string ReasonDescription,

Bool Comment_Is_Editable,

Enum Comment_Enforcement,

string[] Predefined_Comment_List

);

Brackets [ ] indicate an array.

Parameters

Attribute

This is the name of the attribute to be updated and is a string data type.

Can be a constant string, a reference, or an expression.

Supports bound and nested bound references.

For detailed examples of Attribute parameter uses, see the topic Examples of Using the Attribute Parameter in the SignedWrite() Function under "Managing Graphics" in the Creating and Managing Industrial Graphics User Guide.

Example 1:

"UserDefined_001.temp"

Example 2:

"Pump15" + ".valve4"

Example 3:

With UDO_7 containing two string attributes, namestrA and namestrB set to the values "Tank1" and "Tank5" respectively, the following script writes to Tank1.Level or Tank5.Level according to whether strselect is "A" or "B":

Dim strselect As String;

Dim x As Indirect;

{ logic to set strselect to "A" or "B" }

x.BindTo ("UDO_7.namestr" + strselect);

SignedWrite(x + ".Level", 243, "Set " + x + " Level", true, 0, null);

Value

This is the value to be written. Data type is object. The valid range for value must match the data type of the attribute being updated.

Value can be a constant value, a reference, an expression, or NULL if nothing is to be entered.

ReasonDescription

This is text that explains the purpose of the target attribute and the impact of changing it.

Data type is string with a maximum length is 256 characters. It can be a constant string, a reference, or an expression.

ReasonDescription is passed to the indicated Attribute as part of the write operation. The object also includes the user’s write comment, if any. A Field Attribute description is used for the ReasonDescription parameter only if the attribute is a Field Attribute and it has a description (is not null). Otherwise, the Short Description for the corresponding ApplicationObject is used for the ReasonDescription parameter.

Comment_is _Editable

This parameter indicates whether a user can edit the write comment.

Data type is Boolean.

If set to True: The comment text box is enabled with exceptions.

  • If Comment_Is_Editable is true and if the Comment_ Enforcement parameter is PredefinedOnly, the comment text box is disabled. At run time, the user can only select a comment from the predefined comment list.

  • If the Comment_ Enforcement parameter is not PredefinedOnly, the comment list and box are enabled. You can select a comment from the comment list and modify it in the comment box.

  • If the predefined list is empty, the comment list is not shown in the dialog box.

    If set to False: The predefined comment list does not appear in the Secured Write or Verified Write dialog boxes. The editable comment text box is disabled.

Comment_Enforcement

This parameter is of data type Enum, with the following value options:

0 = Optional
The run-time user can enter a comment or leave it blank.

1 = Mandatory
The run-time user must add a comment, either by selecting from the comment list or by entering a comment in the comment box.

2 = PredefinedOnly
The run-time user can select a comment from the comment list only. The comment text box is disabled.

Predefined_Comment_List

An array of strings that can be used as predefined comments.

Data type is string. A maximum of 20 comments are allowed, each with a maximum of 200 characters.

  • The array can be empty (number of elements is 0).

  • Can be a constant, a reference, an expression, or NULL if empty. Can reference an attribute that contains an array of strings.

  • If no predefined comment is entered, the predefined comment list is disabled at run time.

  • If Comment_Is_Editable is False, the predefined comment is still placed in the editable comment text box, but the user cannot modify it at run time.

Return values

Return values indicate success or failure status. A non-zero value indicates type of failure.

0

The function returns a value of 0 (meaning success) if the following are all true:

  • The function parameters were valid.

  • The write operation was successfully placed on the queue for Secured and Verified Writes.

  • If the user cancels the operation, a message is written to the Logger indicating user cancellation.

1

The function failed due to any error that is not covered by the other specified return values. This includes any error that is not covered by the other specified return values. If there is a failure, a specific message is logged in the Logger.

2

One or more parameters were not coerced to the appropriate data type at run time.

Example: Parameter is a reference with Boolean as the expected data type. At run time, reference is to a String data type that cannot be coerced to True or False. The function returns this value and writes a message to the Logger.

3

The attribute parameter was not valid at run time.

  • Attribute string was null, empty, or contained no attribute reference.

  • Attribute string contained an item that was not a valid attribute reference.

  • Attribute string contained an attribute reference that did not exist.

  • Attribute string contained an attribute reference that was not of the Secured Write or Verified Write security classification.

    The function writes a message to the Logger identifying the error and the invalid attribute string.

4

The Comment_Enforcement parameter value was out of the range of valid enumerators.

Remarks

The SignedWrite() function is supported only for client scripting and not for object scripting.

A return value of 0 does not indicate whether the attribute was updated, only that the function placed an entry on the queue to write to the attribute. The operator may decide to cancel the operation after the Secured Write or Verified write dialog box is presented. In this case the attribute is not updated and a message is placed in the Logger indicating that the user canceled the operation. Even if the user enters valid credentials and selects OK, the attribute still might not have been updated because of inadequate permission or data coercion problems.

The SignedWrite() function supports the custom property passed as the first parameter with opened and closed quotation marks, "".

If you configure the custom property CP as shown in the following script, the function attempts to resolve CP and determine if it has a reference. If it has a reference, then the reference is retrieved and the write is performed on the reference.

SignedWrite("CP", value, reason, editable, enforcement, null);

For more information about using the SignedWrite() function, see the topic Working with the SignedWrite() Function for Secured and Verified Writes under "Managing Graphics" in the Creating and Managing Industrial Graphics User Guide.

Examples

SignedWrite ("UserDefined_001.temp", 185, "This will change the oven temperature", true, 1, null);

The following example shows the user an array of predefined comments:

Dim n as Integer;

n = SignedWrite("UserDefined_001.temp", 185, "This will change the oven temperature", true, 1, UserDefined_001.OvenCommentArray[ ]);

where UserDefined_001.OvenCommentArray is an attribute containing an array of strings.

In This Topic
TitleResults for “How to create a CRG?”Also Available in