List Variable - Mapping to an Excel File cell


I’m trying to pull data from an excel file in the ‘List’ variable type format. However when I try to print an item in the list it doesn’t seem to work.

Excel Test File Cell - [“value1”, “value2”]

Above is mapped to List variable ListVar1 via Test Suite Data binding

In my code:

I would expect it to print out ‘value1’, but instead it prints out ‘[’, which seems to indicate to me it thinks the value is a string. Note: I’ve also tried [‘value1’, ‘value2’] and [value1, value2] in the excel cell.

If i setup a list variable in katalon with default value [“value1”, “value2”], then my print statement displays the correct value.

Anyone have any ideas?



ok … so …
you get value as an string. string is basically (can be represented) as an array of chars so by addressing 0 position of string you get 1st char of string “[” in your case
to achieve what you want:
store list in format : value1,value2,value3
use String function split()

class Example {
   static void main(String[] args) {
        String listSource = 'value1,value2,value3'
        String[] list = listSource.split(',')
        println list[0]