restReqQueryKey (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

2.10.00


This function will read the name of a query field in a request.

By calling this multiple times with incrementing index, it is possible to list all the query fields in the request.

 

Input:

req : SYSHANDLE

A handle to the request.

 

idx : INT (Default 0)

The index of the query field to read the name of.

 

 

Output:

name : STRING

The name of the field.

 

 

Returns: INT

1


- Success

0


- Not supported

-1


- Invalid request

-2


- The query field was not found

 

Declaration:

FUNCTION restReqQueryKey : INT;
VAR_INPUT
   req            : SYSHANDLE;
   idx            : INT;
   name           : ACCESS STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
   rc        : INT;
   strname : STRING;
   i         : INT;
   req       : SYSHANDLE;
END_VAR
BEGIN
   ...
 
   i:=0;
   // Get name of query
   rc := restReqQueryKey(req:=reqidx:=iname:=name);
   WHILE rc > 0 DO
      // Get value of query
      restReqQueryGet(req:=reqname:=namevalue:=str);
      DebugMsg(message:=" "+name+"="+str);
      i:=i+1;
      // Get name of next query
      rc := restReqQueryKey(req:=reqidx:=iname:=name);
   END_WHILE;
   ...
END;
END_PROGRAM;