Set a field value without removing what is already there. - InfoPath Dev
in

InfoPath Dev

Set a field value without removing what is already there.

Last post 05-07-2012 09:45 AM by maxibarrios. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-04-2012 03:25 PM

    Set a field value without removing what is already there.

    Hi Guys.

    so here is my problem.

    i have a form that has 2 fields (not only those but this are the importants)

    One is a drop down list that gets the information from a list in sharepoint.

    the other is a people picker.

    what i need to do is, whenever I select something on the drop down list, example selection 1, to include example person 1 on the people picker BUT without removing the people i already added over there.

    thanks in advance for your help!

  • 05-07-2012 09:21 AM In reply to

    Re: Set a field value without removing what is already there.

    Hi there,

    I think what you are trying to do will be pretty difficult to do out of the box because of the way people picker schema works.  Each person is stored in a separate instance of a repeating field. So if you want to add another person you would have to add another node to that repeating field which you cannot do in InfoPath without writing custom code.

    I do have an idea you can try.  If you can get the existing people into a semicolon delimited list (search Internet for double eval trick) and then concat the person you want to add to that string.  Set that value to the first node of the people picker and that may resolve all of the names in that string to what you want.  I haven't tried this myself, but might be worth a shot :)

    Hope this helps!

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 05-07-2012 09:45 AM In reply to

    Re: Set a field value without removing what is already there.

    Anson!

    thanks for the interesting approach. i actually managed to do something like you told me.. ended up like this

    concat(xdMath:Eval(xdMath:Eval(../../../my:Participants/pc:Person, 'concat(pc:DisplayName, "; ")'), ".."), "New Person Name")

     it ended up adding the people i needed it to add so it does the job. but it seems kind of messy since if there were, for example, 2 people in the People picker. it will end up adding the 3rd person but multipling all by two. showing somethign like this.

    person 1; person 2; New Person name
    person 1; person 2; New Person Name

    if there were 3 people at first.

    person 1; person 2; person 3; New Person Name
    person 1; person 2; person 3; New Person Name
    person 1; person 2; person 3; New Person Name

    dont know why but when i prepare the form to be sent of course it only adds them once. so the job is done im just trying to figure out how not to show those added names. (repeated)

    thanks again for the help :)

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