GetValueForMember

TwinCAT TIA
Local File and directory access JSON reader ActiveJsonDocuments A JSON document

ns=2;s=DEPRAG Smart/Local/FileAndDirectoryAccess/Json/ActiveJsonDocuments/0/GetValueForMember

The command returns the value of the specified element. This command is used when a scalar value is expected.

Parameters:

Returns:

    GetValueForMember
    A variable of type OpcMethodReturnValueString. The Result property contains the command-specific return values.
      Result
      The value of the specified JSON element.

Examples:

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

Beckhoff parameter:

    bJsonGetValueForMember
    A boolean variable that can be used to trigger the execution of the GetValueForMember command.
    OutputDataJsonGetValueForMember
    An instance of the "ST_StringOutputData" structure into which the return value of the GetValueForMember method is written.
    hrJsonOpenJsonDocument
    This can be used to monitor the execution of the command. Error codes have the type "HRESULT".
    fbJson
    An instance of the "FB_Json" function block supplied with the DEPRAG Smart library.
    MemberPath
    A STRING(255) variable specifying the path of the JSON element in the JSON file.
    ClientId
    A STRING(255) variable that uniquely identifies the JSON document in the ActiveJsonDocuments list.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
   bJsonGetValueForMember   : BOOL;
   OutputDataJsonGetValueForMember   : ST_StringOutputData;
   hrJsonOpenJsonDocument  : HRESULT;

   fbJson : FB_Json;
END_VAR

hrJsonGetValueForMember := fbJson.GetValueForMember(
         bExecute    := bJsonGetValueForMember,   
         ConnectionHandle := depragSmartConnection.ConnectionHandle, 
         MemberPath   := 'Data.ApiVersionUrl',  
         ClientId   := '0',
         OutputData   => OutputDataJsonGetValueForMember);
IF hrJsonGetValueForMember <> S_FALSE THEN 
   bJsonGetValueForMember := 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".