replacing/changing form of names in rules? - InfoPath Dev
in

InfoPath Dev

replacing/changing form of names in rules?

Last post 07-16-2014 06:46 AM by rcl0404. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-15-2014 12:14 PM

    • rcl0404
    • Top 500 Contributor
    • Joined on 07-15-2014
    • Arlington, VA, USA
    • Posts 29

    replacing/changing form of names in rules?

    Hi, very new to this but I have the basics.

    Situation:

    I have a people picker pulling from an ishare list of names. I want to take the result from this people picker, and pass it to a normal text field. (the people picker still needs to display itself in it's origional form in it's own field) However, it needs to be in a different format and be somewhat cut down in the second text field, "AppName".

    current result in the text field: NETWORK\First.Last

    Desired result in the text field: First Last

    ex. "NETWORK\John.Smith" becomes "John Smith"

    were this code, I would do somthing to the effect of ["NETWORK\" = '\0'] and ["." = " "]

    or somthing to that effect (not working code, I know). I tried doing somthing like this in the formula box, it returned "false" when previewing the form however. Any help? I've seen somthing called "concat" thrown around the web, dont understand it...

    Attempted Method:

    picker pulls successfully, and displays as desired in it's box. I have the text field, "AppName", default value to "AccountID" as it has the least extra stuff in comparison to "DisplayName".

    I have attempted using the translate function, successfully removing and replacing the "." with a space, but it doesnt work at all with actual strings, so im stuck on the removing "NETWORK\" bit with NULL space

  • 07-15-2014 01:03 PM In reply to

    • rcl0404
    • Top 500 Contributor
    • Joined on 07-15-2014
    • Arlington, VA, USA
    • Posts 29

    Re: replacing/changing form of names in rules?

    Just had a thought:

    Is there a way for the field to take into account white space? If I translate "\" and "." to " "(space) then that gives me three separate words. In C++, I could use this. No idea how it works in this program.

     ROUGH-suedo method of doing this in C (im rusty):

    NETWORK\John.Smith->translate(., "\ .", " ")->NETWORK John Smith-- cin>> blank, first, last; cout<<first last;

    I guess I'm asking if separating with spaces makes this easier.

  • 07-16-2014 06:46 AM In reply to

    • rcl0404
    • Top 500 Contributor
    • Joined on 07-15-2014
    • Arlington, VA, USA
    • Posts 29

    Re: replacing/changing form of names in rules?

    Nevermind, figured it out.

    in case this can help anyone else:

    NETWORK\John.Smith

    I used the substring and translate functions like so in a rule:

    translate(.,"."," ") turning above^ into NETWORK\John Smith

    Then

    Substring-after(.,"NETWORK\")

    giving me the final desired result, John Smith

    I guess I wasnt looking for a replace function, the substring-after/before functions work great for inputs with constants.

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.