Forum Discussion
SmartBear_Suppo
Alumni
17 years agoHello,
I wrote a script that allows you to directly modify the Grid DataSource from Groovy:
Replace the first line with one that correctly targets your Datasource.
To use this the Grid DataSource needs to have the proper columns set up ahead of time. Each call to appendRow takes a number of Strings, at most the same number as there are columns available. Hope this helps!
Regards,
Dain
eviware.com
I wrote a script that allows you to directly modify the Grid DataSource from Groovy:
model = testRunner.testCase.testSteps['DataSource'].dataSource.gridModel
def appendRow(String... data) {
def row = model.rowCount - 1
for(i in 0..(data.length-1)) {
model.setValueAt(data[i], row, i)
}
}
//Clear the grid
model.deleteRows(0..(model.rowCount-1) as int[])
//Insert data
appendRow('Hello', 'World')
appendRow('Goodbye', 'Moon')
Replace the first line with one that correctly targets your Datasource.
To use this the Grid DataSource needs to have the proper columns set up ahead of time. Each call to appendRow takes a number of Strings, at most the same number as there are columns available. Hope this helps!
Regards,
Dain
eviware.com