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!
Solved! Go to Solution.
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
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.
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
User | Count |
---|---|
188 | |
53 | |
16 | |
16 | |
15 |
Discuss challenges in energy and automation with 30,000+ experts and peers.
Find answers in 10,000+ support articles to help solve your product and business challenges.
Find peer based solutions to your questions. Provide answers for fellow community members!