Howto use a dropdown list to set a value in a text box? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Howto use a dropdown list to set a value in a text box?

Last post 06-15-2012 01:18 AM by Gennady Vanin (Геннадий Ванин, Новосибирск). 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 06-14-2012 03:49 PM

    • SeanPT
    • Not Ranked
    • Joined on 06-14-2012
    • Posts 6

    Howto use a dropdown list to set a value in a text box?

    I have a very basic sales data entry form. You put in the store number, the sales period, the current year, and the amount sold. This InfoPath 2010 filler form is setup and submitting to the SQL 2008R2 database just fine. 

    But I want to make two changes to help with the data entry and both are to add a drop down box that will then set a value in the form's text box. 

    First there is the store number which is not in a great human readable form. (XX-YY-ZZZZ) So it would be nice if we had a dropdown with the list of the store names (North, West, East, South, etc.) so the person can pick the store and the store number would go into the form. We already have a table in the database that has those two fields.

    Second is the sales period. Each sales period is a week with a week ending date. So it would be nice if they could hit the drop down, find the week ending date, and then the sales period goes into the form. Again, we already have a table in the database that has those two matching fields. 

    I feel like this is something fairly simple and my google fu is weak here. So any links to articles that explain the basics on how this is done would be much appreciated.

    PS - The lady who does this data entry and I were talking today and she said "Wouldn't it be nice if I could just pick the sales period, click a button and have a table with every store so I can just go down a column and fill in the sales data one by one?" -- I told her I would look into it so if you happen to know of a resource to do that as well, I would really appreciate it.

    Thank you

  • 06-14-2012 07:14 PM In reply to

    • SeanPT
    • Not Ranked
    • Joined on 06-14-2012
    • Posts 6

    Re: Howto use a dropdown list to set a value in a text box?

     I'm not sure why this works but it did. I changed the store number to a dropdown box and used the secondary data connection for the lookup source. By putting the value at the number and the display as the name, it seems to work.

  • 06-14-2012 07:19 PM In reply to

    Re: Howto use a dropdown list to set a value in a text box?

    I've read over your post-question few times but couldn't grasp what you were asking. 

    In the title and first 2 sentences you ask "Howto use a dropdown list to set a value in a text box?" but in the last 4 sentences you extend on somewhat unrelated situation of using drop-down-lists only, failing to mention anytextbox . 

    Can you specify which field you want in drop-down-list and which one n textbox?
    Also the database schema is not clear. Are you having a separate table for each field in the Infopath form? 

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 06-14-2012 09:22 PM In reply to

    • SeanPT
    • Not Ranked
    • Joined on 06-14-2012
    • Posts 6

    Re: Howto use a dropdown list to set a value in a text box?

    I'm sorry for the confusion, allow me to clarify.

    I have two SQL tables. The first is for sales data entry and one of the columns for this table is "Store Number" and the data is in the format XX-YY-ZZZZ. Our form is designed to input data into this table and it works just fine.

    We also have another table that is simply the Store Number in the XX-YY-ZZZZ format along with the more human readable store name that goes along with that number (North, West, South, East, etc.) 

    What I wanted to do was to add a dropdown box with these store names (North, West, South, East, etc.) and when the user picked a store name (e.g. West) the text box for the store number would auto populate with the proper store number. 

    What ended up working: I changed the Store Number text box to a dropdown box. I set the  Drop-Down List Box choices to get Choices from an external data source (the store name / number lookup table that I added as a Data connection). I set the Value to be the Store Number but the Display to be the Store name. So on the form you just have one box that has a name (West) but when the form is submitted, the data submitted is the actual number (XX-YY-ZZZZ).

    Hopefully this clarifies my original post for anyone who finds this in the future.
     

  • 06-15-2012 01:18 AM In reply to

    Re: Howto use a dropdown list to set a value in a text box?

    Thanks for explanation

     

    So, the "Store Name" is the user-friendly alias for "Store Number" field name  (from the same MSSQL table or external data-source) and the question ended up into "How to set a drop-down-list display name"?

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.