'double eval trick' and people picker in InfoPath 2010 - InfoPath Dev
in

InfoPath Dev

'double eval trick' and people picker in InfoPath 2010

Last post 04-29-2015 03:08 AM by nathangoss. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 07-05-2011 05:07 AM

    'double eval trick' and people picker in InfoPath 2010

    Despite reading lots of forum posts, several blog posts (incl. the informative walkthrough from alec pojidaev on codeless programming), I find myself needing your expertise..

    I simply cannot get the double eval trick to work when using the people picker in Infopath 2010.

    (I can get it to work with a repeating table though, just not the people picker).

     

    What I want to accomplish:

    Concatenate the AccountId’s of users selected in the people picker, separated by semi-colon, like this:

    domain/user1;domain/user2;domain/user3

     

    What I’ve done so far:

    Created a blank infopath form with the following structure

     

     myFields

    Picker

       pc:Person

          DisplayName
          AccountId

          AccountType

    strAccountIds

     

    Where ‘Picker’ is the peoplepicker and strAccountIds is a text box where I would like the concatenated string to appear.

     

    When I enter the following in Edit Xpath mode:

    xdMath:Eval(xdMath:Eval(../my:Picker/pc:Person, 'concat(my:AccountId, ";")'), "..")

     

    it results in the following:

    eval(eval(Person; 'concat(my:AccountId, ";")'); "..")

     

    and returns this error:

    “"../my:Picker/pc:Person/my:AccountId" does not point to a valid location path of a field or group.”

     

    When I use ‘Insert Field or Group’ to select the AccountId field, this is what is generated in Xpath-mode:

    xdMath:Eval(xdMath:Eval(../my:Picker/pc:Person, 'concat(../my:Picker/pc:Person/pc:AccountId, ";")'), "..").

     

    I have read in other posts that the reference to AccountId must be relative but I can't seem to find the correct relative reference.

    I think it is the 'pc:' before AccountId that confuses me.

     

    Hope someone can help me or point me in the right direction.

  • 07-06-2011 12:07 AM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

    Problem solved as described below:

    Shut down computer, go home, and come back the next morning..then open your form, enter the formula

    xdMath:Eval(xdMath:Eval(Person, 'concat(pc:AccountId, ";")'), "..")

    and it works..!  So it was the namespace thing..

  • 05-08-2012 12:19 PM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

    I still get the pc error,

  • 09-19-2012 07:04 AM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

    I'm using InfoPath 2010 and had a booger of a time getting the 'double-eval trick' code to work...

    There was one little thing I was doing wrong.. to clarify, I'll enumerate all the steps that work for me:

    1.) Open the rules panel (I click the Manage Rules button on the Home tab of my Office ribbon)

    2.) Set up the "Action" rule type by clicking the "Add" button and choose the "Set a field's value"

    3.) Eventually, you find yourself in the Rule Details dialog:

        a.) For the Field: Choose the hidden text field that will contain your string to be generated.

        b.) For the Value: click on the fx button at the right

        c.) CLICK THE CHECKBOX AT THE BOTTOM RIGHT: Edit XPath (advanced)

        d.) Paste in thefollowing code  (in this scenario SubmittedBy is the name of my specific person-picker control):
              xdMath:Eval(xdMath:Eval(my:SubmittedBy/pc:Person, 'concat(pc:AccountId, ";")'), "..")

    Step 3.c highlighted in red, above, is what I was missing all along.

  • 11-23-2012 12:14 PM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

    Hi man, can you help me please? pliiisss i try to filter a repeating table that contain a people picker path: /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Responsable_x0020_acargo/pc:Person/pc:AccountId do you know what i must put in queryFields/Responsable_x0020_acargo? thx man
  • 11-05-2013 10:13 AM In reply to

    • Wesaw3
    • Not Ranked
    • Joined on 11-01-2013
    • Posts 3

    Re: 'double eval trick' and people picker in InfoPath 2010

    I am also having a hard time wih this. Please see below:

    I've been round and round and in and out of forums. I see that this is similar to my inquiry and it is very possible to achieve what I am trying to do.

    First I have the form set up and pointed to my SP list, data connecttions set etc. Works great....

    I have:

    Condition- Rule Runs when Field Is Changed

    Set Field Value:

    Field: (RoleName (PX))

    Value: DisplayName[PX=PX and Title = Title]

    The objective:

    Project Name   Person Role 1 Person Role 2   Person Role 3  Person Role 4

    1234 A               John Doe              Jane Doe          Susan Doe        Blank

                               Peter Doe           Mark Doe

                               Oscar Doe

    Everything is working fine, when a user selects a project name (ie. Drop Down) Infopath. It auto populates the person associated with the role etc...... However if there is more than one person in a SP column, it does not transfer over to Infopath like that. Only one user appears. Currently I am using single text fields to "Display Name" in Infopath. Does my Infopath fields need to be "People Picker" to accomplish this.

    I have read that it is possible to concatenate the values of my SP list and have them display in Infopath as follows: Name1;Name2;Name3. But I am having a difficult time doing this. ie (double eval trick)

    My primary objective is to use the OOB features, no coding. I have read that even using a web service, it is still impossible to display more than one name per field.

    Please help if you can. I am unsure why I do not get the alerts when someone posts a reply. However could anyone post a reply and send a step by step to my email as well.

    Thank You

  • 11-05-2013 03:31 PM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

     Here's a sample w/ a double eval in it. I stored data when I created the list connection, so save it locally from the link, right click and select design. Preview and say "okay" or "yes" (can't remember the option) when it asks about connection to data sources. The connection will fail and it will ask about working offline. If you say "yes" it should use its stored data.

    Hilary Stoupa

  • 02-13-2014 08:03 AM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

    I am having similar issue. In my case, I have a drop-down list control (Let's call it "Team Assignment") which is getting populated from a SharePoint list column "Title". Now, there is a People Picker control called "AssignedTo". The SharePoint list has two columns - Title and SubTeam. When user select a value from Team Assignment (drop-down) the "AssignedTo" value changes.

    Now the SubTeam column has multiple values. That being said, the AssignedTo only shows first value. How do I use the double eval trick to retrieve multiple values in the AssignedTo

    Any suggestions, idea, tricks ?

    Thanks
    Snehal H.Rana
  • 08-05-2014 10:21 AM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

    I am having the same issue.  I've done all the tricks from the blogs I've looked at (closing form, shutting down, editing with xpath, etc).

    My form is deployed as infopath filler form to sharepoint.  Infopath 2010.  I cannot seem to get this to work and am absolutely desparate.  Can anyone help? 

    myFields 

    -ccpeople

    -- pc:person

    ---DisplayName

    ---AccountId

    ---AccountType

    xdMath:Eval(xdMath:Eval(my:ccpeople/pc:Person, 'concat (my:ccpeople/pc:Person/pc:AccountId, " | " ) '), " .. ")

    "my:ccpeople/pc:Person/my:ccpeople/pc:Person/pc:AccountId" does not point to a valid location path of a field or group.

     

     

  • 08-05-2014 10:34 AM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

    Try this: 

    xdMath:Eval(xdMath:Eval(my:ccpeople/pc:Person, 'concat (pc:AccountId, " | " ) '), " .. ")

    Hilary Stoupa

  • 04-29-2015 03:08 AM In reply to

    Re: 'double eval trick' and people picker in InfoPath 2010

    Hi there, I have been trying to do exactly as you have done, however instead of getting Display Name (that is correctly shwon in the People Picker) I get the user's Claims Based id - eg: i:0#.w|domain\userid; Any suggestions on how to get the nice Display Name into the Text Box - eg: First Last? Thanks, Nathan
Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.