Can I get multiple rows from a datasource using datasource correlation?
Can I get multiple rows from a datasource using datasource correlation? e.g. the datasource has multiple rows that have a column matching my xpath. Or, does that only work when there is a single match? Should I use scripting instead? Thanks JT
Comments
-
Hi,
Data Source Correlation will use the first row that matches. So even if there are multiple matches it will only use the first one it finds. If you need to combine multiple rows of data together either scripting or using responder chaining are the options.
1 -
gotcha that's what I was seeing... I am trying to get an entire datasource in Groovy (instead of a single column). Is there a way to grab that from the context?
0 -
ScriptingContext has a "getValues" (plural) method. It works the same as "getValue" but returns a List of all values in a data source column. This can be useful in case you need your script to read all values in a data source as opposed to the values for the current row.
1 -
perfect
0 -
Is there any way to grab the datasource object from the context and use the data in my script?
0 -
The "context" lets you query data source contents by "dataSourceName" and "columnName" only.
Some methods from com.parasoft.api.ScriptingContext:List<String> getValues(String dataSourceName, String columnName) String getValue(String dataSourceName, String columnName)
1 -
gotcha thanks! JT
0 -
so no way to muscle our way in and grab that entire datasource object in the context? ;-)
0 -
I decided to get the absolute filepath of the csv and read it into my Groovy script
0