in

InfoPath Dev

I'm looking to display in a text box the address field of the selected "Customer" from a drop down list box connected to a sharepoint customer list.

Last post 10-23-2008 12:27 PM by Bhavesh. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-29-2008 07:25 AM

    I'm looking to display in a text box the address field of the selected "Customer" from a drop down list box connected to a sharepoint customer list.

    I have a browser enabled form that has a drop down list linked to a sharepoint list of customers. The sharepoint customers list has fields for customer name, address and ID. This drop down list box allows of course one of the many fields to be used, I've selected the customer name. The issue I have is that on the same infopath form I want to display the address of the now selected customer name on the form and I just can't figure out how to do that. This would not only help to "auto populate" the form fields but it would solve an issue I have where I do have multiple customer records of the same name on this sharepoint list with different addresses. The issue being that people can't tell what the address is, all they would see in this one drop down list are two records example "Company abc, Complany abc". It would be super nice if as they select the first "Company abc" a field right next to it display's the address, they then could move to select the next company abc and see the address for that one ect.

     Can I do this with browser enabled forms, and if so how please. This would take my forms to a new level!  :)

  • 05-29-2008 08:47 AM In reply to

    Re: I'm looking to display in a text box the address field of the selected "Customer" from a drop down list box connected to a sharepoint customer list.

    You should be able to put a rule on the field which the drop down is bound to.

    Use a set field action to set the address field based on the name, although if you have multiple identical names that might be an issue. You may need to use the ID or something. or make your names unique in your list.

    I believe this should be browser compatible.

  • 10-23-2008 12:27 PM In reply to

    • Bhavesh
    • Top 150 Contributor
      Male
    • Joined on 05-01-2008
    • Atlanta
    • Posts 34

    Re: I'm looking to display in a text box the address field of the selected "Customer" from a drop down list box connected to a sharepoint customer list.

    Hi,

    You have two drop downs, one for customer and one for address of selected customers. For dislpaying the address of selected customer from first dropdown follow these steps

    * create secondary data source for retrive data. (name it Customer) this will fetch customer info from SP list. while creating this secondary data source keep the checkbox ON for retriving the data on load.

    * create another secondary data source for retriving data. (name it Address)  this will fetch customer address info from the SP list. while creating this data source keep the checkbox OFF for retriving the data on load

    * copy the following code

    public void Customer_Changed(object sender, XmlEventArgs e)

    {

    XPathNavigator cities = MainDataSource.CreateNavigator();

    cities.SelectSingleNode("/my:myFields/my:Address", NamespaceManager).SetValue("");

    SetAddressOptions();

    }

    private void SetAddressOptions()

    {

    FileQueryConnection q = (FileQueryConnection)this.DataConnections["Address"];

    q.FileLocation = q.FileLocation + "&FilterField1=Custcode&FilterValue1=" + GetAddressValue();

    q.Execute();

    }

     

    private string GetAddressValue()

    {

    XPathNavigator nav = this.CreateNavigator();

    string filtervalue = nav.SelectSingleNode("/my:myFields/my:Customer", this.NamespaceManager).Value;

    return filtervalue;

    }

     

    This is working fine for me for my web based infopath form running in SP environment.

    Hope will work for you as well

    Enjoyyyyyyy

    Bhavesh

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