Using the "allow multiple selections" in "Value Relation Widget" results in {value1,value2,...}. But arrays in QGIS are written like ['value1','value2',...]. How do I handle the multiple selection results? For example, if I would get the first entry in my list. With usual arrays I would use this syntax: array_get('array',0).

enter image description here


This is a map with only keys. You can get them using map_akeys('yourmap') which will turn it into an array of all keys.

So your syntax could be map_akeys('yourmap')[0] or array_get(map_akeys('yourmap'),0)

Similary you could use map_avals('yourmap') to get all values or map_get('yourmap','key') to get a specific value.


This may help:

array_get( string_to_array( substr( "array", 2, -1 ) ), 0)


    string_to_array( substr("array", 2, -1)),
    array_get( @arr, 0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.