Display Fields from a Different List - InfoPath Dev
in

InfoPath Dev

Display Fields from a Different List

Last post 11-30-2011 11:41 AM by Hilary Stoupa. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-29-2011 01:16 PM

    Display Fields from a Different List

    I have a SharePoint 2010 site with two (2) lists - Events and Attendees.  The Event Id is included on the Attendee list to form a many to 1 relationship (many attendees can attend 1 event).

    I'm customizing the Attendees list's form using InfoPath 2010.  I'd like this form to display some information from the Event - Time, Place, Cost... that sort of thing - with having to save the Event Time, Event Place and Event Cost in the attendees list.

    Can anyone suggest a way to accomplish this - preferably without (much) custom code?

    Thank you.

     Tom

     

  • 11-29-2011 03:21 PM In reply to

    Re: Display Fields from a Different List

    Hi Tom,

    When you customize your attendees form you will need to make a secondary data connection to the Events list.  Details on how to do that can be found here: http://office.microsoft.com/en-us/infopath-help/add-a-data-connection-to-a-sharepoint-document-library-or-list-HP010093160.aspx

    Next, you will need to do a lookup or filter on the Event data based on which attendee you have selected in your form.  Here is a video that touches on filters to get you started: http://channel9.msdn.com/Blogs/laurhar/Use-Rules-and-Filters-to-Create-Cascading-Dropdowns-in-InfoPath.

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

  • 11-30-2011 07:50 AM In reply to

    Re: Display Fields from a Different List

    Hi Anson,

    Thanks for the quick response.

    I'm familiar with secondary data connections and know how to retrieve and select, look-up and filter the results to get the exact data that I need.

    My question was more about getting the data to display on the attendee form in such a way that I can submit the form without saving the event info to the attendee list.

    As it stands now, if you decide that you want to attend event #1 (and bring a guest!), you'll open my info path from from a link that includes "?EID=1" in its query string.  The InfoPath form will use the EID (Event ID) to

    • Call my secondary data source
    • Retrieve the event name, time, and location from the events list.
    • Display the event name, time and location in Text Boxes on the form.

    The problem I'd like to solve is that those Text Boxes create new fields on my Attendees list so that when you click the "save" button on the form you create a list item like:

    • Name; Anson Hidajat
    • Event ID: 1
    • Number Attending: 2
    • Event Name:  Annual Holiday Party
    • Event Date: Dec 15, 2011 7:00 PM
    • Event Location: Four Seasons Hotel

    I'd like to only save your name, the event ID and the number attending in the activities list.  Is there a way to do this?


     

  • 11-30-2011 09:27 AM In reply to

    Re: Display Fields from a Different List

    As long as your secondary data connection is set up as Retrieve Data only, then you shouldn't have to worry about writing back data to the events list. Instead of using query strings, try using filters on the event data based on the event ID.  Hopefully that will accomplish the behavior you want.

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

  • 11-30-2011 09:46 AM In reply to

    Re: Display Fields from a Different List

    Hi - when you say you display the name, time and location in text boxes on the form - what are those text boxes bound to? Are you using rules to populate fields in your main data source with the data from the secondary data source? As Anson mentions, InfoPath is only going to save data from the main data source.

    It sounds to me as if you are working with a SharePoint List form - is this correct? If you don't want to have the Event Name, Date and Location in your list, they'll need to be removed from the list columns (form's main data source).

    Hilary Stoupa

  • 11-30-2011 11:27 AM In reply to

    Re: Display Fields from a Different List

    Anson,

    No one is concern about writing back to the events list.  This form doesn't write to the events list.  The problem is that when I add text boxes to the form to display data that has been read from the events list, InfoPath adds fields to the attendees list to store that data.  I'm trying to avoid adding fields to the attendees list.

     Hilary,

    Yes.  Exactly.  This is a List Form that I have modified using InfoPath.  I need to add an unbound control of some sort (probably text box, but it could be a label or really anything that can display text).  This unbound control needs to be something that I can set to display data that had been retrieved from a secondary data source.  I am using rules to populate the fields I would like to display.

    What I don't know is how to do that.  I tired what I think you just suggested (i.e. adding the text box then removing the column that the text box was bound to).  That created the unbound text box, but I'm not able to programmatically add text to it.

    Any ideas?

    Thanks for you help.

    Tom

  • 11-30-2011 11:41 AM In reply to

    Re: Display Fields from a Different List

    You definitely don't want to be setting main data source fields to these values - since you don't want them saved to your list.

    You should be able to use a calculated value control with the XPath to the field in your secondary data source. You may also be able to just drag the field from your secondary data source onto the form - if I remember correctly, by default a ShP list form shows the data source task pane in a "simplified" view (that I find hard to work with) - at the bottom of that task pane is a link you can click to change to the "normal" view. From there, you should be able to use the drop down at the top of the data source task pane to switch to your secondary data source, and just drag the field you want to display onto the form - does that make sense?

    Hilary Stoupa

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