Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
84650members
353990posts

[Imported] SQL Commands to extract rows from Data Table in ST

EcoStruxure Geo SCADA Expert Forum

Find out how SCADA systems and networks, like EcoStruxure Geo SCADA Expert, help industrial organizations maintaining efficiency, processing data for smarter decision making with IoT, RTU and PLC devices.

Solved
sbeadle
Janeway Janeway
Janeway
0 Likes
1
521

[Imported] SQL Commands to extract rows from Data Table in ST

>>Message imported from previous forum - Category:Scripts and Tips<<
User: hemanth, originally posted: 2019-10-08 11:28:11 Id:534
Hi,
I have created a data table [TEST1_TABLE] in clearscada with Index1,val1,val2 all INT type.
Inserted few rows using INSERT command.
Is it possible to extract number of rows to an internal variable in ST to perform some calculation! I have been trying the following code to extract rows from DataTable but not successful in transferring to internal variables [ Rec_count,val1,val2]
IS TEHRE A WAY TO GET ROWS?

TYPE Records:
STRUCT
Index1:INT;
val1:INT;
val2:INT;
END_STRUCT;
END_TYPE

PROGRAM SQL_EXTRACT
VAR
pump1data :Records;
END_VAR;

VAR
Rec_count :INT;
val1 :INT;
val2 :INT;
END_VAR;

VAR

Test1 AT %S(Select Index1,val1,val2 FROM TEST1_TABLE WHERE Index1 = 2):RESULTSET OF RECORDS;
END_VAR;

IF Test1.Valid = TRUE THEN

Rec_count := pump1data.Index1;
val1 := pump1data.val1;
val2 := pump1data.val2;

END_IF;

END_PROGRAM

 

 


Accepted Solutions
sbeadle
Janeway Janeway
Janeway
0 Likes
0
520

Re: [Imported] SQL Commands to extract rows from Data Table in ST

>>Responses imported from previous forum


Reply From User: geoffpatton, posted: 2019-10-08 20:41:59
I think it is Test1.Size is the number of rows


Reply From User: hemanth, posted: 2019-10-10 03:54:32
Thanks..
following link provides more info...
https://www.citect.schneider-electric.com/scada/clearscada/help/2017/Content/LogicGuide/UsinganSTPro...

See Answer In Context

1 Reply 1
sbeadle
Janeway Janeway
Janeway
0 Likes
0
521

Re: [Imported] SQL Commands to extract rows from Data Table in ST

>>Responses imported from previous forum


Reply From User: geoffpatton, posted: 2019-10-08 20:41:59
I think it is Test1.Size is the number of rows


Reply From User: hemanth, posted: 2019-10-10 03:54:32
Thanks..
following link provides more info...
https://www.citect.schneider-electric.com/scada/clearscada/help/2017/Content/LogicGuide/UsinganSTPro...