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.
|
|
Comment_Enforcement |
This parameter is of data type Enum, with the following value options: 0 = Optional 1 = Mandatory 2 = PredefinedOnly |
|
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.
|
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:
|
|
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.
|
|
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.