List to String Microflow

Hello,   I would like to see if someone can help me out figuring how to make a list into a string, lets say that for a production number I have different order codes, and I would like to have all of its code into a string so that I can display it as follows. I would like to have an attribute that displays the codes(enumeration)  the codes for a specific production number as a production codes(string).   Currently, I had the idea of the following microflow, and I would like to know what to write as an expression for it and if I am retrieving the correct object. (I will also attach my domain model in the pictures). Thank you all in advance. .      
2 answers

Your variable string should start as '’ and in the iterator place the following expression in the change variable action:

trim($varString + ' ' + (if $Production_Number/ProductionCode != empty then getKey($Production_Number/ProductionCode) else ''))

You can use a seperator if you want and you  need to check if productioncode != empty to prevent exceptions using the getKey.


Edit, I'm using Pro, this is quote quote.

I missed a closing bracket in my initial expresion for the getKey. Its updated now.



Hello Sjors Schultz,

Thank you for your reply! how should I set the initial value as '’  I tried writing it on the Mendix “set initial value to” space and I think I'm not doing it right, sorry I'm new to this .


Then for the expression in the change variable action I get the following which does not let me use it: