How to format Numeric Values in Drop-Down List Box? - InfoPath Dev
in

InfoPath Dev

How to format Numeric Values in Drop-Down List Box?

Last post 04-10-2015 02:11 AM by Mel Clemente. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-08-2015 01:09 PM

    • Gracie
    • Not Ranked
    • Joined on 04-08-2015
    • Posts 2

    How to format Numeric Values in Drop-Down List Box?

    Hi.  I am new to this forum, and have a question that I'm hoping someone can answer.  I am working in InfoPath 2010 with SharePoint 2007.  I have a drop-down list box that is populated with numeric values (integers) from a SharePoint list.  The drop-down list box is a text field.  I understand that the numeric values from SP come into InfoPath as numbers.  I need to format the values in the drop-down list box to remove the decimal place and trailing zeroes.  I am able to do this for single text box fields using the substring-before function, but I can't apply the function to all of the values in the drop-down list box.  I have tried changing the data type of the drop-down list box to a both Whole Number and Double Precision, but still can't get formats to work.  Further, when I do change the data type and try to use the form, the field errors out.  Is there any way to format the numeric values in a drop-down list box that is data type Text?  Can I use some XPath code when I am setting the value of the field?  Thank you for any help!

  • 04-10-2015 02:11 AM In reply to

    Re: How to format Numeric Values in Drop-Down List Box?

    Hi,

    Here are some tricks that you can try in order to have your dropdown list box remain as a text field and display numeric values as a whole number format:

    1. Add a hidden calculated column value in your SharePoint list that removes the decimal places of your number column, thus coming up with a whole number equivalent of your actual number column. Add this in your data connection fields and point your dropdown list box entries to that new calculated column.
    2. Add a hidden helper column in your SharePoint list (maybe name it "Format Number"), add it in your data connection fields and then add a rule in that secondary data source field that sets your number field using your substring-before method. You'll then add a rule that maybe fires on form load that sets the Format Number field to something like "1" just to trigger its rule.
    3. Export your form's source files and modify the view XSL so that the dropdown displays numeric values without the decimal stuff (also using substring-before).

     If you need more details in doing any of the techniques above, please don't hesitate to contact [email protected] and we'd be happy to assist you.

    Cheers!

    Mel Clemente
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

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