You are currently viewing the content available in Vietnam. If you are looking for information for another region, please select the correct country from the top-left dropdown in the page and 'Navigate to Browse FAQs' in the Support menu.
Use script code in Geo SCADA to read and modify DataSetRows Cell Expressions
In Geo SCADA, there are various methods for defining the Data Set Rows expression. There is a detailed instruction in the Geo SCADA Expert Guide on how to manually set the expression in the Data Set Rows. In this article, I'll go over how the script codes in Geo SCADA can be used to read and write expressions in the Data Set Rows.
Initially, as you observe in the screenshot, I created a Data Set Row called DataSetRow 1 and connected it to Data Set 1, which has four different fields. I have manually created the expression of the fields of DataSetRow 1 and the "InsName" expression is set to ‘Reservoir’.
Image 1- Data Set1
Image 2- DataSetRow 1 initial Values
Therefore, we must have access to the Data Set Rows’ methods, which is this article's primary objective.
Following the Database Schema reference (https://tprojects.schneider-electric.com/GeoSCADAHelp/Geo%20SCADA%202020/Content/DatabaseGuide/WorkingwiththeDatabaseSchema.htm), there are two distinct methods to obtain and modify the cell expression in Data Set Row objects: GetCellExpr and SetCellExpr. The preview of the table in the database schema is displayed in the following screenshot.
Image 3- Data Set Row Method part 1
Image 4- Data Set Row Method part 2
The sample code I have provided will instruct you how to obtain and modify the field "InsName" expression from/to "DataSetRow 1."
Sub SetDataSetRow()
Set ObjDataSetRow = Server.FindObject(Server.ThisObject.Parent.FullName & ".DataSetRow 1")
MsgBox (ObjDataSetRow.Interface.GetCellExpr("InsName"))
ObjDataSetRow.Interface.SetCellExpr "InsName","'Valve'"
End Sub
The Data Set Row location within the database can be found using the first line, Server.FindObject(Server.ThisObject.Parent.FullName & ".DataSetRow 1"). The object's location within the same Mimic group is indicated by the usage of "Server.ThisObject.Parent.FullName." The "FindObject" method retrieves the variable of "Serverobject" and stores it in the "ObjDataSetRow".
We need to implement the interface method in order provide access to the Data Set Row's Methods. Therefore, when the second line is executed, a message box displaying the "InsName" field's expression appears.
Image 5- Retrieved Cell Expression
Lastly, as you can see in the screen shot below, the third line change the "InsName" cell expression to the "Valve" and stores it in the DataSetRow 1 object.
Image 6- Modified Cell Expression
In Geo SCADA, there are various methods for defining the Data Set Rows expression. There is a detailed instruction in the Geo SCADA Expert Guide on how to manually set the expression in the Data Set Rows. In this article, I'll go over how the script codes in Geo SCADA can be used to read and write expressions in the Data Set Rows.
Initially, as you observe in the screenshot, I created a Data Set Row called DataSetRow 1 and connected it to Data Set 1, which has four different fields. I have manually created the expression of the fields of DataSetRow 1 and the "InsName" expression is set to ‘Reservoir’.
Image 1- Data Set1
Image 2- DataSetRow 1 initial Values
Therefore, we must have access to the Data Set Rows’ methods, which is this article's primary objective.
Following the Database Schema reference (https://tprojects.schneider-electric.com/GeoSCADAHelp/Geo%20SCADA%202020/Content/DatabaseGuide/WorkingwiththeDatabaseSchema.htm), there are two distinct methods to obtain and modify the cell expression in Data Set Row objects: GetCellExpr and SetCellExpr. The preview of the table in the database schema is displayed in the following screenshot.
Image 3- Data Set Row Method part 1
Image 4- Data Set Row Method part 2
The sample code I have provided will instruct you how to obtain and modify the field "InsName" expression from/to "DataSetRow 1."
Sub SetDataSetRow()
Set ObjDataSetRow = Server.FindObject(Server.ThisObject.Parent.FullName & ".DataSetRow 1")
MsgBox (ObjDataSetRow.Interface.GetCellExpr("InsName"))
ObjDataSetRow.Interface.SetCellExpr "InsName","'Valve'"
End Sub
The Data Set Row location within the database can be found using the first line, Server.FindObject(Server.ThisObject.Parent.FullName & ".DataSetRow 1"). The object's location within the same Mimic group is indicated by the usage of "Server.ThisObject.Parent.FullName." The "FindObject" method retrieves the variable of "Serverobject" and stores it in the "ObjDataSetRow".
We need to implement the interface method in order provide access to the Data Set Row's Methods. Therefore, when the second line is executed, a message box displaying the "InsName" field's expression appears.
Image 5- Retrieved Cell Expression
Lastly, as you can see in the screen shot below, the third line change the "InsName" cell expression to the "Valve" and stores it in the DataSetRow 1 object.
Image 6- Modified Cell Expression