Forum Discussion

krishn's avatar
krishn
Helper I
2 years ago
Solved

String concatination in ADF

we are trying to concatinate three strings including " in it, but Azure data factory adding as ". Question is how do we get rid of \ character. I Have one set variable returning value ABCDEFG and I wanted to concatenate with other data to populate like below in a variable. {"value"}:{"ABCDEFG"}

I am using the syntax in set variable like @replace(concat('{','"','value:',variables('requiredvalue'),'}'),'\ ','') and I am getting output value as "value": "{"value:ABCDEFG}"

Appreciate for help

I am using the syntax in set variable like @replace(concat('{','"','value:',variables('requiredvalue'),'}'),'\ ','') and I am getting output value as "value": "{"value:ABCDEFG}"

expected output {"value"}:{"ABCDEFG"}

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hello krishn ,

    We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet.
    In case if you have any resolution please do share that same with the community as it can be helpful to others .
    Otherwise, will respond back with the more details and we will try to help .

  • krishn's avatar
    krishn
    2 years ago

    Hi Team, as per the recommendation it is not required to eliminate \ special character from string. But we observed these special characters are printing when we copy it to CSV/text file in Blob storage. As long as value stay in Azure environment we do not have to worry about \ character. We are working on alternatives. Appreciate for help. 

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi krishn ,

    Thanks for using Fabric Community.
    Can you please try this expression?

    @concat('{"value"}:{"', variables('requiredvalue'), '"}')


    Let me know if this works or not?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello krishn ,

      We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet.
      In case if you have any resolution please do share that same with the community as it can be helpful to others .
      Otherwise, will respond back with the more details and we will try to help .

      • krishn's avatar
        krishn
        Helper I

        Hi Team, as per the recommendation it is not required to eliminate \ special character from string. But we observed these special characters are printing when we copy it to CSV/text file in Blob storage. As long as value stay in Azure environment we do not have to worry about \ character. We are working on alternatives. Appreciate for help. 

    • krishn's avatar
      krishn
      Helper I

      I tried this in first place but we are betting the below resule added \ to it, we also validated priting the same string but is still there. Ultimately we wanted to get rid of \ added 

       

      "{\"value\"}:{\"ABCDEFG\"}"

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi krishn ,

        \ is an escape sequence inorder to preserve " in string and it will not include when you print the output.

        Escape Sequences | Microsoft Learn

        For Example:

         



         

         

         




        Hope this is helpful. Please let me know incase of further queries.

  • Apologies for delay, we validated the same and re-produced same result. Within the application it is excluding \ character however if we print this to a csv or txt file in blob object it is still printing the \ character.  Seems we have to use StoredProcedure or Databricks activities to pars string. Appreciate for help. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi krishn ,

      Glad to know that you got some insights.
      Please continue using Fabric Community on your further queries.