HasMember

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

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

This command can be used to check whether the specified element is included in the JSON document.

Parameters:

Returns:

    HasMember
    A variable of the OpcMethodReturnValueBoolean type. The Result property contains the command-specific return values.
      Result
      A boolean variable indicating whether the element is included in the JSON document.

Examples:

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

Beckhoff parameter:

    bJsonHasMember
    A boolean variable that can be used to trigger the execution of the HasMember command.
    OutputDataJsonHasMember
    An instance of the "ST_BoolOutputData" structure into which the return value of the HasMember method is written.
    hrJsonHasMember
    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
   bJsonHasMember   : BOOL;
   OutputDataJsonHasMember   : ST_BoolOutputData;
   hrJsonHasMember  : HRESULT;

   fbJson : FB_Json;
END_VAR

hrJsonHasMember := fbJson.HasMember(
       bExecute    := bJsonHasMember,   
       ConnectionHandle := depragSmartConnection.ConnectionHandle, 
       MemberPath   := 'Data.ApiVersionUrl',  
       ClientId   := '0',
       OutputData   => OutputDataJsonHasMember);
IF hrJsonHasMember <> S_FALSE THEN 
  bJsonHasMember := 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".