How to get the index of particular row of the datagrid in UiPath form designer when the values from datatable passed to datagrid?
this datatable is present in the form designer.I want to get the index of each row dynamically.Can anyone suggest a javascript code to write in the advanced logic of form designer in UiPath?
@hana.noorudheen
You can do this by looping through the DataTable and comparing the values of the row with the values.
Make sure you have access to the DataTable from which the DataGrid is populated.
Use For each activity Set the DataTable as the source or the For Each Row activity.
Within the For Each Row loop, you can use an “If” activity to compare the values in the current row of the DataTable with the values.
If row(“ColumnName”).ToString = “DesiredValue” Then
’ Match found, you can take action here
’ row.Index will give you the index of the current row in the DataTable
End If
Inside the “If” condition where you’ve found a match, you can use “row.Index” to get the index of the current row in the DataTable.
Cheers…!
hi I need to write the logic inside the form designer,that is in the advanced logic section.Also I have to write code in javascript
Use this Code
JavaScript code to execute when the button is clicked
document.querySelector(‘#yourButtonId’).addEventListener(‘click’, function() {
Your JavaScript logic here
alert(‘Button clicked!’);
});
in form designer in the advanced logic section each time we write a looping conditon it works for each row sepearately and values cannot be stored as such.Do you have a solution for that