What's the correct way to create Empty List variables?

I've been unable to find a way to create a truly empty List variable in a Script.
Despite what's mentioned in Refresh List in script , if you create an "empty" list Variable, the list still has an empty string in the first place, which creates a blank space when you start pushing values into the List.

image

Scenario:
I have 2 lists, one being filled by a Data Action with values (ticket ids) , the other is one that displays customised labels for the corresponding values. So the first (lets call it idList) is the values list for a dropdown while the second (statesList) is the Label list for the dropdown.

image

Any time a search is executed I assign the Array of values to idList through the Data Action, but (since data actions lack tools for iteratively process a variable number of string inputs in a list), I have a series of dynamic variables that generate the desired labels and push them one by one into the "emptied statesList" (by previously assigning it the "EmptyList", except I can't find a "simple" way of creating a truly empty list. it always have an empty string in the first place, as you can see in the screenshot:

image

This in itself would be just a graphical glitch and perfectly bearable... however, this misaligns the value-label lists, so in the screenshot the ID 643007 has the value below it, 642960. (You can also note that the last Label is not displayed because the value list has only five elements while the label list has six)

I am able to create an empty List by using a "dummy" data action the outputs an Empty array, but I would prefer to not be calling Data Actions without needing to (I'm calling /api/v2/date and always outputting an empty array)

You can see in this example that the list has no empty item in the first place.

I have also tried the "Set Variable" and not configure the second value (thinking it would give a not_set or null value), but this of course creates an error.

(For this specific issue I would accept a way to creating a truly dummy data action that doesn't call any webservice endpoint, since the Data Action workaround works... but the question remains of how can you start from scratch on a List in order to start pushing values into it.

So, there's no (clean) way to create an empty List variable or a way to reset a List correctly to an empty state.

1 Like

I don't have a solution, but I have the same issue. If I load data into a list from a Data Action, there is no blank row, but if a list is only used within the script, there is a blank row at the top. I don't know how to get rid of the empty row.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.