How to make it possible for a dynamic global variable to interact with csv at the same time

Hello everyone! I am presenting the following scenario:

  1. A test case is generated with the call to several endpoints, each dependent on the response of the previous endpoint.
  2. The first endpoint requires the input of a random variable, which was defined within the profile with a method that generated a random string.
  3. By incorporating a csv into this test case, and starting iterations, the global variable maintains the value during execution.
    An attempt was made to incorporate a Loop, which would execute the script as many times as there were rows the file added to try to call the global variable in each iteration, however, it maintains the value of the first call, and the file’s iterations are multiplied with loop iterations.

Could you help me? How could some of these options be realized:

  1. Incorporate dynamic data into an existing data file.
  2. Ensure that global variables are treated in conjunction with data files.

I’m not sure I totally understand, however, I assisted another OP with looping using a spreadsheet. Note the use of a variable, row, as a parament in the getValue() method. As the loop counter increments, the next row in the spreadsheet is read–the data was horizontal. Maybe this might help you.
Obviously, if your data is vertical, you will have to switch columns in the getValue() method.

def data = TestDataFactory.findTestData("Data Files/Honda")
WebUI.comment("row count is ${data.getRowNumbers()}")

for (int row = 1; row <= data.getRowNumbers(); row++) {
	debitRequestedRef = data.getValue(1, row)
	creditRequestedRef = data.getValue(2, row)

As for a Global Variable, you can assign any data value (of the correct data type) to it.