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
84244members
353343posts

Getting Record ID of a selected Data Table Row as an argument into a Pick Action script

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
Cbhasin
Ensign
Ensign
0 Likes
2
1197

Getting Record ID of a selected Data Table Row as an argument into a Pick Action script

I am trying to get the Record ID of rows (Data Table that is queried into a list) into a script through a pick action. I need to edit certain values in the rows using a form and needed the selected row's Record ID into the function as an argument? Or is there any other way to do this?

Cheers!


Accepted Solutions
sbeadle
Janeway Janeway
Janeway
0 Likes
0
1185

Re: Getting Record ID of a selected Data Table Row as an argument into a Pick Action script

The property CurrentRowIdx will indicate what row was clicked (in the order of all rows queried). As the row index depends on the sorting etc, this can be problematic, as you would need your script to requery the list and work out which row was selected. However, we made this easier in 2019 - see clip from release notes here:

 

Using Scripts with SQL Queries on Mimics

We have extended the scripted properties available on lists within mimics. These enable the data values in the first column of the list to be read after the click. Properties are Current1stColDataStr for a string column and Current1stColDataInt for integer data. Previously it would have been necessary to read the row number of the clicked list, then re-run the query from script to check which row data was selected. These new properties allow script to be more efficient. For example, add a query to a mimic with the SQL SELECT DESCRIPTION FROM CSEVERITY. Then add a script pick action which includes:

 

MsgBox "You clicked row " & _
         Mimic.Layers("New Layer").Item("Lst_1").CurrentRowIdx & _
         " Text " & _
         Mimic.Layers("New Layer").Item("Lst_1").Current1stColDataStr

 

 

See Answer In Context

2 Replies 2
JChamberlain
Schneider Alumni (Retired)
Schneider Alumni (Retired)
0 Likes
1
1190

Re: Getting Record ID of a selected Data Table Row as an argument into a Pick Action script

I don't have a huge amount of experience with data tables so I could be wrong, but to my knowledge data tables don't have a Record ID column unless you add one yourself. So unless you have some other unique field I guess adding a RecordID column would be the solution.

sbeadle
Janeway Janeway
Janeway
0 Likes
0
1186

Re: Getting Record ID of a selected Data Table Row as an argument into a Pick Action script

The property CurrentRowIdx will indicate what row was clicked (in the order of all rows queried). As the row index depends on the sorting etc, this can be problematic, as you would need your script to requery the list and work out which row was selected. However, we made this easier in 2019 - see clip from release notes here:

 

Using Scripts with SQL Queries on Mimics

We have extended the scripted properties available on lists within mimics. These enable the data values in the first column of the list to be read after the click. Properties are Current1stColDataStr for a string column and Current1stColDataInt for integer data. Previously it would have been necessary to read the row number of the clicked list, then re-run the query from script to check which row data was selected. These new properties allow script to be more efficient. For example, add a query to a mimic with the SQL SELECT DESCRIPTION FROM CSEVERITY. Then add a script pick action which includes:

 

MsgBox "You clicked row " & _
         Mimic.Layers("New Layer").Item("Lst_1").CurrentRowIdx & _
         " Text " & _
         Mimic.Layers("New Layer").Item("Lst_1").Current1stColDataStr