Search code examples
mule-studiomule-componentmule-esbmulesoft

Sequence of numbers from 1 to 100 in a List in Mulesoft


I have a list with a sequence like #[[1,2,3,4]. I want to define another list with sequence of numbers from 1 to 100. I tried to use #[[1..100]] but this is not allowed. How can i achieve this in mulesoft ?


Solution

  • In mule 4 and dataweave 2 .. operator is used for different use-case now. For a range use to instead:

    #[1 to 100]
    

    In mule 3 and dataweave 2, use .. but if you want it as an inline expression, you need to wrap it in dw function

        #[dw('[1..100]', 'application/java')]
    

    Or use the the transform-message component for non inline transforms