Access data source table in Groovy script

Speedy993Speedy993 Posts: 21

I am trying to access a table defined as a data source in a Groovy script as part of a web scenario test. This script just needs to get a substring of one of the columns in the table.
The error I am getting says ' No Data Source column named BookingNbr'. My data source is defined as type Table and has these columns: BookingNbr DefendantName DefendantLastName DefendantFirstName DefendantMiddleName .
The script is very basic and is this:
import com.parasoft.api.*;
import java.util.*;

public String getBookingNbrSubstring(ScriptingContext context)
String bookingNbr = context.getValue("DataHold", "BookingNbr").get(1);
Application.showMessage("BookingNbr: " + bookingNbr);
String partialBookingId = bookingNbr.substring(4)
Application.showMessage("partialBookingId: " + partialBookingId);

return partialBookingId;

Any suggestions as to why I am getting this error? Can the script not find the table data source? This seems like such a basic thing to do.




  • Speedy993Speedy993 Posts: 21

    My apologies. Somehow the 'Use data source' check box in the Edit Script window became unchecked and I did not notice that until just now. The script is working as it should now.

    Sorry and Thanks!

Sign In or Register to comment.