Skip to main content
marcot0005
June 7, 2022
Solved

Convert List to single value

  • June 7, 2022
  • 11 replies
  • 0 views

Is there a good way to convert a list of items with no more than 1 item in it to a single item? There are 2 ways I know of, both have minor issues depending on the context. 

1) use an index such as array[1] to get the first value of the array - This works, but requires some null checking in case the array is empty as it will bug out if that is the case.

2) use cast, but this requires knowing the type ahead of time, and if that's not possible, neither is this casting method. 

Is there any other way I'm missing? Some hidden fromList() function I haven't found yet?

Best answer by mikes0011

index(ri!list, 1, null())

11 replies

mikes0011
mikes0011Answer
Brainy
June 7, 2022

index(ri!list, 1, null())

marcot0005
June 7, 2022

Thanks! That seems perfect.