none
ReplaceString for brackets RRS feed

  • Question

  • Hi, I've been trying to replace a bracket in the sync rule, i.e.

    ReplaceString(ReplaceString(someattribute,"(","#"),")","#")

    but FIM is complaining the function ReplaceString is not correctly formatted.

    Also I notice

    If I use CustomExpression 

    ReplaceString(someattribute,"(","#")

    FIM fails with ReplaceString is not correctly formatted.

    but if I select FIM function -> ReplaceString and enter oldstring as ) and newstring as #, FIM would happily accept.

    Any idea how I can get around this?

    Thanks,

    John

    Wednesday, April 9, 2014 1:40 AM

All replies

  • why don't you use FIM function then?
    Wednesday, April 9, 2014 2:32 PM
  • I want to replace both brackets "(" and ")", function will only replace one, the second one needs to use custom expression
    Wednesday, April 9, 2014 4:26 PM
  • ahh..Can you use workflowdata? Using fim workflows to calculate the value and pass that as workflowdata to the sync rule?
    Wednesday, April 9, 2014 4:38 PM
  • I don't think workflowdata will work in my case, the value needs to be updated/recalculated whenever the my attribute changes.

    The other way I thought about is using rules extension, but I was hoping for something easier in the sync rule...

    Wednesday, April 9, 2014 4:56 PM
  • I may have a work around but whether it works ultimately depends on your goals.

    I have found that an unmatched open or closed parenthesis will confuse the syntax checker in the sync rule editor.

    You could try putting it in through Advanced view (could be tricky) or again depending on your data and what you need from it this might work:

    DatawithParens

    (Fred Frankenstein)

    Desired outcome

    #Fred Frankenstein#

    CustomExpression("#" + Word(DatawithParens,2,"()") + "#")

    The Word function spits your data into words based on the delimiting characters and doesn't include them in the words.

    Scenario 2:

    DatawithParens

    Fred (Frankenstein)

    Desired outcome

    Fred #Frankenstein#

    CustomExpression(Word(DatawithParens,1,"()") + "#" + DatawithParens,2,"()") + "#")

    The caveat with this approach is that you need to know how many sets of parenthesis you will encounter if it varies then this won't work. So if the data looks like this:

    Fred (Frankenstein)

    Frank (Fredenstein) (Franky)

    Then this wouldn't work.


    David Lundell, Get your copy of FIM Best Practices Volume 1 http://blog.ilmbestpractices.com/2010/08/book-is-here-fim-best-practices-volume.html

    Friday, October 2, 2015 4:06 AM
  • Why do you think that workflow cannot be fired upon attribute change/update?

    MPR can be bound to attribute update/modification and fire your required workflow.

    Friday, October 2, 2015 8:33 AM
  • Any update on this? I'm having the same problem and would like to replace both brackets () in my phone numbers.
    Wednesday, February 3, 2016 9:48 AM