WinCC OA Queries

This chapter describes the query functions supported by a backend.

A backend supports the following WinCC OA query functions:

Information about the requested function is stored in the functionUsed field of the QueryRequest class. The request contains the following information:

  • data point attributes
  • data point names, data point alias, or data point name pattern
  • request interval
  • conditions imposed on the query
  • conditions of grouping
  • sorting conditions
  • aggregate functions
  • the size of the data to send, etc.

Notes and Limitations:

  • A separate alertgetquery field is used to process the alertGet function .
  • When requesting bonuses, it is necessary to find a bonus for each requested data point in the request.
  • When requesting a limit, the limit applies to the entire request.
  • Query with aggregate functions currently only works with dpQuery().

Example of request processing:

ReadResponse processReadRequest(const FrontendRequest& request)
{
   // ...

    const auto queryRequest = request.query();
    const auto queryFunc = queryRequest.functionused();
    
    switch (queryFunc)
    {
        // int dpQuery (string query, dyn_dyn_anytype &tab);
        // or dpQueryNGA
    case QueryRequest_QueryFunctionUsed_DpQuery:
        break;
        // int dpGetPeriod (time t1, time t2, int count, string dp1, <dyn_type1> &xa1, dyn_time &ta1 [,string dp2, <dyn_type2> &xa2, dyn_time &ta2);
        // or dpGetPeriodNGA
    case QueryRequest_QueryFunctionUsed_DpGetPeriod:
        break;
        // int dpGetAsynch(time t, string dp1, <type1> &var1 [, string dp2, <type2> &var2 ...]);
        // dpGetAsynchNGA
    case QueryRequest_QueryFunctionUsed_DpGetAsynch:
        break;
        // int alertGetPeriod(time t1, time t2, dyn_time ×, dyn_int &counts, string alert1, dyn_string &dpa1, <dyn_type1> &vala1 [, string alert2, dyn_string &dpa2, <dyn_type2> &vala2 ...]);
        // or alertGetPeriodNGA
        break;
    }
   // ...
}