xpath replace functionality - InfoPath Dev
in

InfoPath Dev

xpath replace functionality

Last post 06-19-2012 01:38 PM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-19-2012 01:31 PM

    xpath replace functionality

    I search the forums and did not see an identical post, but this must be a typical request.

    I need to replace all occurances of WordA with WordB inside a field.

    I tried this:

    concat(substring-before(field, "WordA"), "WordB", substring-after(field, "WordA"))

    The problem I having is "WordA" may not exist in the string, so it returns empty.

  • 06-19-2012 01:38 PM In reply to

    Re: xpath replace functionality

    Is there a chance that WordA can occur in the string multiple times?  If not, I think this would work:

    concat(substring(field, 1, 1000 * not(contains(field, "WordA"))), substring(concat(substring-before(field, "WordA"), "WordB", substring-after(field, "WordA")), 1, 1000 * contains(field, "WordA")))

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.