none
Better String Concatenation

    Question

  • I'm calling a REST API that requires quite a few parameters. Is there a better way to concatenate strings than using @concat?

    I know this can be done: @concat('https://myapi.com/api/?date=', pipeline.runtime) But having 4 or more parameters I end up have a mess of nested @concats. Any better way of doing this?

    Thanks.


    Wednesday, November 7, 2018 7:32 PM

All replies

  • Hello,

    I'd be curious to see what one of your calls looks like with all the @concat if you would like to share.

    Wednesday, November 7, 2018 9:55 PM
    Moderator
  • Hi Brian,

    ADFv2 supports a feature called string interpolation when the expression appears inside strings , where expressions are wrapped in @{ ... }. This keeps you from using messes of "@concat", you could use: 'https://myapi.com/api/?date=@{pipeline.runtime}' in your scenario.

    Also I'm afraid that the way you reference pipeline parameter "@pipeline.runtime" isn't right, it should be "@pipeline().parameters.runtime", this doc demonstrates the details about expressions supported by ADFv2. Thanks.

    Thursday, November 8, 2018 2:13 AM
  • Thanks! giving that a try now.
    Thursday, November 8, 2018 12:36 PM
  • I didn't follow thru with all the parameterizations, once I did two I realized I was headed down an ugly path considering down the road I may have more to add.

    Thanks

    Thursday, November 8, 2018 12:42 PM