Replace inline function

Comments

2 comments

  • Avatar
    Sampat Patil

    Hi Bhabesh,

     

    Can you please try Update Process Data activity instead on Inline Function?

    and below is the Expression

    Convert.ToString(${/pd:AP/pd:formFields/pd:Address}).Replace("\"",@"\""");

     

    Let me know if this works.

     

    0
    Comment actions Permalink
  • Avatar
    Yaniv Levi

    Hi Bhabesh,

    How have you been?

    Because this are special characters, you'll need to escape them with the \ with the relevant case matchers.

    One option is indeed to go with the Update Process Data activity which can have fully .NET compatible expression, as showed by Sampat Patil in above post, still this characters needs to be escaped (and/or you can use the string literal @ as also shown in Sampat sample).

    Or you can still use the Inline Function activity, but escape the special characters, so your @Replace inline function expression will look like:

    @Replace(${/pd:AP/pd:formFields/pd:sReplaceExpresion}, "\"", "\\"").

    Another alternative, is to use the old var and new characters as fields/process variables (or in case this is your use case from the get go), so either they are a configurable option or they are dynamically set by the users/app data - in this case, use the XmlDecode inline function (under Text), so incase the value holds special characters they will be handled correctly - here is a sample:

    In the following form, you provide the expression the character the replace (i.e old character) and the character to replace with (i.e new character):

    The inline function replace repression:

    @Replace(${/pd:AP/pd:formFields/pd:sReplaceExpresion}, (@XmlDecode(${/pd:AP/pd:formFields/pd:sReplaceChar})), (@XmlDecode(${/pd:AP/pd:formFields/pd:sReplaceWith})))
     
    And the end result is:
    (Ignore the sample of domain"user value does not make real sense - could not think any real sample for your specific characters - this is just to show-case).
     
    Hope this clears out and help.
    Thanks,
     
    Yaniv.
    0
    Comment actions Permalink

Please sign in to leave a comment.