Drop down list value to SQL - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Drop down list value to SQL

Last post 05-14-2009 12:36 PM by ppmvisk. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-13-2009 04:04 PM

    Drop down list value to SQL

    I saw one post with the opposite question sorry if I missed mine and repeat it.  Also, granted I'm a newbie but I'm trying to understand how to take the value of the selection and pass it a database record.  Pretty typical set-up I think, drop down is populated by a table from SQL Server 2005.  For simplicity here the table has two columns "Plant-Key" and "Plant-Name"  So data is like this:

    1 Chicago
    2 Paris
    3 Sao Paulo

    The value is the number and the display name is the text.  The user selects the display name / text on the form.  The text is an item in the main data source.  The value is not.  Can I simply set a fields value based on the secondary data source definition and have it use the correct selected item?  In this example it would appear in the form rules on set field value as "@Plant-Key".

    Or better / more simply asked, how can I access the value associated with the selected text?

    If that is impossible, I've also seen the option on this forum to use a concatenation so that it is displayed as "1-Chicago" in the text, and then to substring it back out.  Since the tables exist and the dropdown is from the external data source, I'm not sure where I would manipulate the data on the form before and after accessing the data source.

     Thanks for any comments.

  • 05-14-2009 11:52 AM In reply to

    Re: Drop down list value to SQL

    Hi, and welcome!

    Forgive me, I'm confused. You have a drop down list bound to a field in your main data source, and the list is populated with values from a secondary data source, is that correct? The control is set to use the 'key' {1,2,3 in your sample data} as the value for the control, and the 'name' {Chicago, Paris, Sao Paulo from the sample data} as the display, am I still on track? So, if that is the case, the field in your form will be storing 1, 2, or 3, depending on what is selected from the list..... if you want the control to contain the 'name' information, you can change the value in the control to be bound to the data node that contains the 'name'.

    If I've missed the entire point (very likely, I'm afraid), please explain a bit further....

    Hilary Stoupa

  • 05-14-2009 12:36 PM In reply to

    Re: Drop down list value to SQL

    You got the point exactly.  Thanks for the reply.  This is the answer also, I did not realize until much later that what I see and what is stored are not the same - makes sense now since each View gives new text / display name for each value and of course that would only work if the stored item is the code / value.  Now I also understand why only the opposite question gets posted but you've supplied the answer to that as well.  Many thanks and best regards.

     P

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