[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;
Test1 AT %S(Select Index1,val1,val2 FROM TEST1_TABLE WHERE Index1 = 2):RESULTSET OF RECORDS; END_VAR;