Returned data in dpQueryConnect()

Find and share HowTos to various installations / configurations!
4 posts • Page 1 of 1
AdrianSan
Posts:13
Joined: Thu Aug 27, 2020 5:17 pm

Returned data in dpQueryConnect()

Post by AdrianSan »

Hi there,

I need to trigger an alert when some DPEs meet a certain condition. Let's say I need to trigger the alert when DP.Working == TRUE and DP.ValveState == 4.
I am using a dpQueryConnectSingle to connect to both DPEs of all DPs. The problem is that, when some of those changes, the "data" passed to the callback only contains the very DPE that has changed, but not the other one.

I need the callback to get me both DP.Working and DP.ValveState, even if only one of them changed. I have seen that dpQueryConnectAll() passes it all, but I do not want every DP in every call.
Is there any solution to this?

Thank you in advance.
Using WinCC OA 3.18 P1

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Returned data in dpQueryConnect()

Post by leoknipp »

If the elements are defined in the same datapoint you can possibly use the option to address the elements in the SELECT statement, e.g. ValveState:_online.._value, in combination with a DP type filter in the WHERE condition.
For details please have a look at the WinCC OA Documentation.
https://www.winccoa.com/documentation/W ... ere%2C_dpt

Best Regards
Leopold Knipp
Senior Support Specialist

AdrianSan
Posts:13
Joined: Thu Aug 27, 2020 5:17 pm

Re: Returned data in dpQueryConnect()

Post by AdrianSan »

Thank you for your response, it worked just fine.

However, doing it that way, it only catch the first ocurrence of "ValveState".
I will post my problem here for future reference.
It happens that I actuallly have embedded DPT inside of a DPT so I have

DP_01.Valve_01.ValveState
DP_01.Valve_02.ValveState
DP_01.Valve_03.ValveState

and so on, but setting the ".DPE" in the SELECT makes it yield only the Valve_01.ValveState.
I think I will stick with using dpGet() inside the connected function, even when it is a waiting function.

OR

I can include in the query all the Valves in the SELECT. The setback is that when some the ValveState changes, it gives me all the ValveStates of the DP, but it can't be helped.

Thank you again, BR.

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Returned data in dpQueryConnect()

Post by leoknipp »

As I do now know which query string you are using I cannot tell you if there are other solutions.
Doing a dpGet() in a work function for data which can be queried is not a proper way. Also you may get "wrong" values as the data can change between triggering the work function and calling the dpGet().

Best Regards
Leopold Knipp
Senior Support Specialist

4 posts • Page 1 of 1