ToolDataItemByKey

TwinCAT TIA
Devices DEPRAG devices Sequence controller ActiveDevices One client System info Tool data

ns=2;s=DEPRAG Smart/Devices/DEPRAG/AST/ActiveDevices/0/SystemOverview/ToolData/ToolDataItemByKey

Requests a specific value of the tool data.

Parameters:

    Key
    Unique identifier that determines which entry is to be retrieved from the tool data.

Returns:

    ToolDataItemByKey
    A variable of type OpcMethodReturnValueString. The Result property contains the command-specific return values
      Result
      Value of the requested parameter.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bAstToolDataItemByKey
    A Boolean variable that can be used to trigger the execution of the ToolDataItemByKey command.
    outputAstToolDataItemByKey
    An instance of the ST_StringOutputData structure into which the return value of the ToolDataItemByKey method is written.
    hrAstToolDataItemByKey
    This can be used to monitor the execution of the command. Error codes have the type HRESULT.
    fbAst
    An instance of the FB_AST function block supplied with the DEPRAG Smart library.
    sDeviceId
    A string value specifying the device for which tool data is to be fetched.
    sKey
    The string variable specifies which parameter of the tool data is to be read out.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
     bAstToolDataItemByKey    : BOOL;
     outputAstToolDataItemByKey   : ST_StringOutputData;                                          
     hrAstToolDataItemByKey    : HRESULT;

     fbAst   : FB_AST;
END_VAR

hrAstToolDataItemByKey := fbAst.ToolDataItemByKey(
       bExecute    := bAstToolDataItemByKey,   
       ConnectionHandle := depragSmartConnection.ConnectionHandle,
       sDeviceId   := '0',
       sKey    := 'm_WZ_Schraubertyp',
       OutputData   => outputAstToolDataItemByKey);
IF hrAstToolDataItemByKey <> S_FALSE THEN 
 bAstToolDataItemByKey := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".