URGENT : Azure Logic Apps : Unable to split string when delimiter is specified in a variable

Lakshmi Rajesh 21 Reputation points
2020-09-23T03:33:16.66+00:00

String splitting seems to work when the delimiter is specified thus, directly in the split code as such :

"inputs": {
"name": "partDescription",
"value": "@split(variables('emailWithoutHeader'),'myName')"
}

The following code, however does not work : (userName is a string variable where i store user name received in the trigger body)

"inputs": {
"name": "partDescription",
"value": "@split(variables('emailWithoutHeader'),variables('userName))"
}

Appreciate any help understanding how to make this code work, without hard coding any string values

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,868 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mike Urnun 9,756 Reputation points Microsoft Employee
    2020-09-23T20:34:20.07+00:00

    Hi @Lakshmi Rajesh

    It looks like you're missing an enclosing single quote (') around the variable name variables('userName) in your @split(..) statement.

    I tried to quickly reproduce the issue and splitting with variable parameters is working for me as expected:
    27771-image.png

    In the example above, I provide a payload of:

    {  
        "delimiter":"|",  
        "parameter":"hello|world"  
    }  
    

    and get back a response of:

    [  
        "hello",  
        "world"  
    ]  
    

    Hope this helps, please let me know if you have any additional questions.


0 additional answers

Sort by: Most helpful