Subscribing is a smart move!
You can subscribe to this forum after you log in or create your free account.
Geo SCADA Knowledge Base
Access vast amounts of technical know-how and pro tips from our community of Geo SCADA experts.
Originally published on Geo SCADA Knowledge Base by sbeadle1 | June 10, 2021 01:02 AM
TYPE Point : DATABASE_OBJECT(CPointAlgManual) FullName : STRING; CurrentValue : LREAL; END_DATABASE_OBJECT; END_TYPE
TYPE Point : STRUCT Id : DINT; FullName : STRING; CurrentValue : LREAL; END_STRUCT; END_TYPE
VAR Points AT %S(SELECT Id, FullName, CurrentValue FROM CPointAlgManual) : RESULTSET OF Point END_VAR
VAR Points AT %S(SELECT Id, FullName, CurrentValue FROM CPointAlgManual WHERE FullName LIKE '%' || ? OR FullName LIKE ? || '%') : RESULTSET OF Point WITH_PARAMS Name, Name; END_VAR
VAR Points AT %S(SELECT Id, FullName, CurrentValue FROM CPointAlgManual WHERE FullName LIKE ?) : RESULTSET OF Point WITH_PARAMS Name; END_VAR
WHILE Points.Valid DO Count := Count + Points.Value.CurrentValue; Points.Next(); END_WHILE;
WHILE Points.Valid DO IF Count > 100 THEN Points.Last(); Points.Next(); (* Required else could cause an infinite loop after a few points had be summed up in the Count value*) ELSE Count := Count + Points.Value.CurrentValue; Points.Next(); END_IF; END_WHILE;
Create your free account or log in to subscribe to the forum - and gain access to more than 10,000+ support articles along with insights from experts and peers.