How can I set a field's value based on another field's value in drop down list
-
Freitag, 27. April 2012 08:47
Hi, I have a drop down list which gets its values from a custom list. The items of the list show the text description but the value of the list is the code.
I would like to be able to set another field's value to the text description selected.
How can I do this? If I set it the the drop down list value then it is equal to the code rather than the text.
I know it's pretty simple but I've not don much InfoPath!
Alle Antworten
-
Freitag, 27. April 2012 09:04Moderator
Hi,
I think you are looking for this..
Hope it could help
Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"
-
Dienstag, 1. Mai 2012 13:51
Thanks, I'm like the original poster in that thread, I didn't follow Clayton's instructions either.
I found this to be more helpful
http://koobarspoint.blogspot.co.uk/2010/06/cascading-drop-downs-with-infopath-2010.html
- Als Antwort vorgeschlagen Hemendra AgrawalMicrosoft Community Contributor, Moderator Mittwoch, 2. Mai 2012 05:10
-
Dienstag, 1. Mai 2012 22:01
Hi Dan Rooney,
When you populate a dropdown, you notice it has two options for the values in that dropdown list: 'Display Name' and 'Value'. Display Name is simply what will be displayed to the user, commonly friendly text. The Value portion is what will be stored in the Form's XML when you save or submit it.
In your example, the dropdown's Display Text is the friendly description, where the value is a non-user-friendly code. When you select a value in your dropdown, the value which is stored is the code, not the actual text. Therefore in order to set another field's value to the description, you need to do one of two things:
A) The easiest solution would be to simply set both the Display Text and Value equal to the description. The problem with doing this is that it may affect other functionality in your template that would rely on the actual code.
B) The other option is to do the following:
- Backup your InfoPath template (*.xsn).
- Right click on the field you wish to set this description to and go to 'Properties'.
- Click the 'fx' button to the right of the ‘Default Value’ field.
- Click on 'Insert Field or Group...'
- Click the dropdown at the top and change Data Sources to the Custom List containing the list of Descriptions and Codes.
- Select the 'Description' field under 'dataFields' and click the 'Filter' button.
- Click Add.
- Click the Left dropdown, and choose 'Select a Field or Group'.
- Choose the ‘Code’ field. Click OK.
- Click the Right dropdown, and choose 'Select a Field or Group'.
- Change the dropdown at the top to 'Main'. Select the dropdown field.
- Click OK, OK, OK, OK, OK, OK. Preview and test it out!
What these steps essentially say is, Set this field's value to the description in the custom list where the code matches what is selected in the dropdown.
I hope this helps, let me know if you get stuck with these steps!
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Regards,
Ian Kavanagh
Microsoft Online Community Support- Als Antwort markiert Jinchun ChenMicrosoft Employee, Moderator Dienstag, 8. Mai 2012 02:36

