Store drop down list display name? - Solved - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Store drop down list display name? - Solved

Last post 12-08-2004 11:17 AM by Greg Collins. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-29-2004 06:27 AM

    Store drop down list display name? - Solved

    I have a drop down list that shows company names and the values are the company ids. I get this data from a web service (DataSet). How do I get access to the display name to store it in the main data source?

    The companyID will store the value. I would like to populate the companyName via a rule when the selection changes.


    <root>
    <parent companyID="" companyName=""/>
    </root>

  • 11-29-2004 11:00 AM In reply to

    Re: Store drop down list display name? - Solved

    Use a rule on the drop-down list that populates the field that will store the company name. That rule will filter the web service list for the company whose id matches the selected id in the drop-down list, and then use the matching name to populate the company name field.

    Greg Collins [InfoPath MVP]
  • 11-29-2004 11:47 AM In reply to

    Re: Store drop down list display name? - Solved

    Thanks Greg. I keep forgetting about the secondary data source.

    I created a rule that will populate the @CompanyName field when the user selects the name from the drop down list. It works the first time. But on subsequent selections it doesn't update the @CompanyName field. I tried to set a condition on the rule but that didn't work.

    What am I missing?

    Thanks for the help.
  • 11-29-2004 12:57 PM In reply to

    Re: Store drop down list display name? - Solved

    You placed the rule on the drop-down list box? If so, and if you set NO condition, the rule should be run each time a change is made to the value of the node the drop-down list is bound to.

    Greg Collins [InfoPath MVP]
  • 12-02-2004 08:19 AM In reply to

    Re: Store drop down list display name? - Solved

    It seems that I have created the Rule incorrectly. Problem is I don't know how to create the XPath correctly to get the Display Name associated with the value. Here is how I created the Rule.

    I created a test InfoPath doc with 2 fields (field1 and field2). field1 is a drop down and field 2 is a text box. field1 gets it's data from the secondary datasource (web service that returns a dataset with 2 columns (companyid and company name).

    Setting the datasource for the drop down list I select the repeating table from the provided tree for the Entries text box. For the Value, I select the field companyid. For the Display Name, I select the field companyname.

    For creating the rule, I select the Action "Set a field's value". For the field I select field2 from the main datasource. For the Value, I select companyname from the secondary data source.

    When I preview the form, I select any company name from the drop down but it always selects the first company name to display in field2.
  • 12-06-2004 08:09 AM In reply to

    Re: Store drop down list display name? - Solved

    After rereading Greg's answer above, I noticed the word "filter". So What I ended up doing is I selected the CompanyName field from the secondary source. I selected the Filter button. Here I selected CompanyID field from the secondary source. I selected "is equal to" from the drop down list. I selected companyID from the main source.

    That did it!

    Thanks Greg. I just have to read very carefully your answers from now on. :P
  • 12-08-2004 11:17 AM In reply to

    Re: Store drop down list display name? - Solved

    Great! Glad to hear you got it working!

    Greg Collins [InfoPath MVP]
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.