Get the display name of the selected Drop Downlist box Instead of Value - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Get the display name of the selected Drop Downlist box Instead of Value

Last post 05-01-2009 03:37 AM by paralyzedcitizen. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-20-2007 10:53 PM

    Get the display name of the selected Drop Downlist box Instead of Value

    Hi Guys,

    I have a dropdownlistbox with 4 Items, which are entered manually like

    Value                           DisplayName

    0                                 Patient

    1                                Nurse

    2                                 Doctor

    3                                Referral 

     Lets say user selects Nurse, I want to send Nurse to the database and not 1 but when I use the code

    mainNav1.SelectSingleNode("/dfs:myFields/my:ComboReason", NamespaceManager).Value it returns 1 but I want to get the actual DisplayName, how can I do it plz let me know ASAP.

    Thanks very much guys

    Cheers

    Chandra 

  • 06-20-2007 11:09 PM In reply to

    Re: Get the display name of the selected Drop Downlist box Instead of Value

    You cannot. The display value is a pure view notion and view cannot be accessed by neither rules not scripting.

    Your workaround is to define an aux data source based off an XML file where you will type the values for the dropdown. For example, it may look like this:

    <data>
      <option value="0">Patient</option>
      <option value="1">Nurse</option>
      ...
    </data>

    Now you can bind your dropdown to this data source instead of typing the data in manually. Then when you look at /dfs:myFields/my:ComboReason, you can look up this value in the data source for the aux dom and find your string there.

    A bit of an effort, but it works!

    Good luck!

    Dave

     

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 05-01-2009 03:37 AM In reply to

    Re: Get the display name of the selected Drop Downlist box Instead of Value

     An easier way to achieve this (in my opinion) is put both peices of informaiton into the value field seperated by a unique seperator like an underscore. eg.

     Value                Display Name

    0_Patient           Patient

    1_Nurse             Nurse

    etc.

    Then create two other fields which by default equal the value of the above field only using the string-before/string-after functions.

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