auto fill other fields - InfoPath Dev
in

InfoPath Dev

auto fill other fields

Last post 12-10-2014 08:35 AM by TracyW. 31 replies.
Page 1 of 3 (32 items) 1 2 3 Next >
Sort Posts: Previous Next
  • 03-31-2006 12:44 PM

    auto fill other fields

    How do i create a section that when a user selects a filed in a drop down list, the next few related fields will auto fill. Example a sales rep chooses his name from a drop down list and then his sales id, sales manager, and territory are automatically selected.
  • 03-31-2006 12:57 PM In reply to

    Hi tazzmann and welcome to the forum!

    This is a popular question! The easiest way to do this is with a rule on the drop-down list. The rule on the drop-down will determine which value was selected and perform the "Set field's value" action on the appropriate fields throughout the form.

    There is another way to do this with a secondary data source that makes things much easier to setup.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-03-2006 07:39 AM In reply to

    fantastic. how can i do this with a secondary data source?
  • 04-04-2006 11:33 AM In reply to

    Your secondary data source will be structured like this:

    Items ( group )
    -Item (repeating group)
    --ID
    --Name
    --Manager
    --Territory

    Now, populate the drop-down with the ID as the value and the Name as the display name.

    Add a rule to the drop-down that set's a field's value, with an equation like this:

    xdXDocument:GetDOM("SecondaryDataSource")/ns1:myFields/ns1:Items/ns1:Item/ns1:Manager[../ns1:ID = current()]

    The above example would set the Manager name to the correct value. To do the others you would just change "ns1:Manager" to whatever field you want to update. Also, be sure to change ns1 to the appropriate namespace for your form.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-06-2006 11:36 PM In reply to

    Is it possible to do the same thing but with a text box instead of dropdown list?
    I have 5 other fields to populate when a user enters a userid. All the data is in a sharepoint list, including the userid. What I need is that when a user enters a userid, it is validated against the userids in the sharepoint list, and then the rest of the fields are populated.

    I have over a 100 userids so a dropdown list doesnt seem practical. Have tried searching everywhere for a solution to this problem! Appreciate any help...
  • 04-07-2006 09:03 AM In reply to

    Hi harsha911 and welcome to the forum!

    Yes, you should be able to do this with a textbox or really any other type of control by following the exact same process as described above.

    I hope this helps, let us know if you have any problems.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-09-2006 09:33 PM In reply to

    • SamDahl
    • Top 500 Contributor
    • Joined on 03-29-2006
    • Australia
    • Posts 44
    Just to be difficult, suppose I have a secondary datasource like this:

    <sites>
    <site value="BAT" displayName="Bathurst"/>
    <site value="ECH" displayName="Echuca"/>
    </sites>

    I have a DDL for site and when the user selects their site I want to autofill a hidden field with that site's 3 letter abbreviation.
    The site field has displayName as both it's Value and Display Name (for other reasons).

    After reading this post I tried to implement the solution with a rule on the DDL that sets the hidden field's value with the following formula:
    xdXDocument:GetDOM("Sites - Hierarchical Data Source")/Sites/Site/@value[xdXDocument:GetDOM("Sites - Hierarchical Data Source")/Sites/Site/@displayName = current()]

    The trouble is that when a user selcts the Site it populates the other field with the first value it finds in my 2DS. It doesn't seem able to apply the filtering.

    These were my assumptions:
    -the first xpath was the value to be put into the desired field
    -the next part was the condition/filtering ( [...] )
    -the xpath inside the square brackets was the value to look for in the 2DS
    -and the current() would use the current value of the DDL to compare with what in found in the 2DS

    I suspect I'm trying to use this inappropriately.
    Any help would be much appreciated
  • 04-09-2006 09:40 PM In reply to

    You're on the right track, try this instead:

    xdXDocument:GetDOM("Sites - Hierarchical Data Source")/Sites/Site/@value[../@displayName = current()]

    The problem with your statement is that the test that you specified tests to see if there is a node present that matches the query, and returns the first row for which this is true. Your query is actually asking "are there any nodes that have the value current()". This is always true (since you are defining current() from the list of nodes) and since this is always true it will simply return the first row because the first query came back as true.

    I hope this helps you understand better and I think the XPath I provided above should make things work for you! Let us know if there are any other questions.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-09-2006 10:16 PM In reply to

    • SamDahl
    • Top 500 Contributor
    • Joined on 03-29-2006
    • Australia
    • Posts 44
    Ah, that makes more sense. Thanks for the help; it works beautifully!
  • 04-11-2006 09:43 PM In reply to

    • Carlos
    • Top 500 Contributor
    • Joined on 01-24-2006
    • Australia
    • Posts 31
    I have a similar use, where I have two drop downs, and I can select a value from either and it populates the other Drop Down related to the value. HOWEVER, this does not work with repeating tables. Im using a formula, not a secondary data source, where I stipulate that drop down A = Drop Down B with a filter specifying the equal value, eg ID Number. But when I try this on a repeating section, it doesnt look at the values for each section individually, but looks at all the drop down values and get all messy from there. Any ideas how to solve this?
  • 04-13-2006 09:20 AM In reply to

    Hi Carlos.

    You will probably need to use the XSL current() function for this problem. I would have to know more about your schema and what exactly you are trying to accomplish. Could you paste the XPath you are using currently and a sketch of the relevant schema?
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 12-16-2008 03:04 PM In reply to

    I must have been working on this form entirely too long because I don't understand how to set up the rule in the drop-down.

     I have created a form with a drop-down field (Person's Name) in the primary data shource  - how do I have the system pull in and display (expression box) with the matching information (telephine and email) from the secondary source.

     Also - do you know how to easily create a sequential number system.

     Look forward to your response.

  • 12-16-2008 04:37 PM In reply to

    Gayle,

    If I misinterpret your question, let me know, but I think we can figure this out for you easily.  Try these steps:

    1. Create a secondary data connection to your SharePoint list that has all the data relevant to each person (assuming this is where the data resides).  When configuring the data connection, be sure to check the boxes for each piece of metadata that is relevant (Name, Telephone, Email, ID).
    2. Create a data field (text) in your primary data source that you can call "name."  Also, create two more text data fields for "telephone" and "email."
    3. Drag that field onto your empty canvas.
    4. Right-click the text control and make it a drop-down list.
    5. Double-click the dropdown and choose the radio button for using an external data source - select the aforementioned data source from step 1
    6. Configure the data source so that you are pulling from the library in the first box, are DISPLAYING the name in the display box, and are pulling either the name or ID into the Value field
    7. Create a rule on this drop-down control that has no conditions and has actions that set the value of "telephone" and "email" in your primary data source to the associated values coming from the secondary data source.  It's basically 'set value of "telephone" (primary) to value of "telephone" (secondary" where ID = "name" (primary)'  In place of ID, you could use "name," but I think it's better to use ID, since that is a unique, sequential number that is easier to manage than a person's full name.

    After this, as soon as a name is selected in the dropdown, your other two fields will be populated with the associated telephone # and email address.

    An even BETTER way to do all of this is to use the UserProfileService to pull this data directly from the Profile Database, which is populated by Active Directory.  That way,  you don't have to manage a list manually, and the data is always as current as the most recent profile import (daily, if not incrementally through the day depending on your setup).  This requires more advanced knowledge, and I can teach you step-by-step, but I'd rather you try the above simple steps to ensure you can do that first.

    Thoughts?

    -Clayton

  • 12-17-2008 01:34 PM In reply to

    Thanks for the response .. I have set up the 2 lists but don't understand the LAST step.

     I have created a list CCSInfo with CCSName, CCSPhone, CCSEmail as the secondary.  I have the CCSName drop down pointing to the secondary list but how do I get it to fill the phone and email for the expression boxes automatically.

  • 12-17-2008 01:43 PM In reply to

    Ok, so when you create the data connection to that new library, be sure that it pulls down those 3 data fields in the data connection when the form opens.  Then, set your dropdown to pull from that data connection with both the display name and value being the CCSName.  Then, in your primary data source fields for email and phone, set them to default to CCSPhone and CCSemail WHERE the primary data source name is equal to the secondary data source CCSName using a filter on the default function.

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