Page 1 of 1

SQL Queries with LIKE on dyn_*

Posted: Mon Jun 28, 2021 3:03 pm
by n.kuehl
Hello,

I have an archived dyn_int datapoint and would like to use the WHERE statement to filter it upfront a request. I know the data is valid if the length is for example 7. My Idea was, i could use the the LIKE statement combined with wildcards. I got a working proof of concept query:
SELECT '_offline.._value', '_offline.._stime' FROM 'my_dp' WHERE '_offline.._value' LIKE \"? | ? | ? | ? | ? | ? | ?\" TIMERANGE(\"2021.05.01 00:00:00.000\",\"2021.06.30 00:00:00.000\",1,0)
It gives me all values with length of 7. If I want all data having a 16 on index 2 I would expect just replacing the second question mark. This gives me as well the expected result: All data containing a 16 at the second index inside my timerange.
But when I want to filter after the first index containing a 1, the result is empty, but there is data.

Is this an unexpected behavior or am I using it wrong? I am using WinCC OA v3.16 P27.

Best Regards

Re: SQL Queries with LIKE on dyn_*

Posted: Mon Jul 05, 2021 12:21 pm
by leoknipp
A query statement is a string and therefore filtering for dyn_int values (or any other dyn_array) possibly does not work as string filtering rules are applied.
Maybe it is also related to the type of database which are using for archiving (HDB, RDB).

Best Regards
Leopold Knipp
Senior Support Specialist