Warning: changing a field from time to text - InfoPath Dev
in

InfoPath Dev

Warning: changing a field from time to text

Last post 05-06-2008 04:00 PM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-05-2008 12:59 PM

    Warning: changing a field from time to text

    I had several time fields that I changed to text. When I entered "1:23" into one of the text fields, it showed "1:23", but an Expression Box view of the field showed it as "1:23:00". Apparently something within InfoPath was still treating it as a time field. Deleting the old fields and creating new ones from scratch eliminated the problem.

    Chris
     

  • 05-05-2008 04:00 PM In reply to

    Re: Warning: changing a field from time to text

    Text Boxes and Expression Boxes can be set up to format as almost any data type. So likely what happened was you converted the date field into a text field (which reset it to use text formatting), but your Expression Box was still set to use Time formatting. That could have been fixed by going into the Expression Box properites dialog and changing the formatting to Text.

  • 05-05-2008 05:04 PM In reply to

    Re: Warning: changing a field from time to text

     Greg,

        Just to make sure, I created a new form, added a time field, set the default to 0:00, showed it in a text box, and it displayed 12:00:00 AM. I added two Expression Boxes that showed the field, one with time format and the other with text format; the time formatted one showed 12:00:00 AM and the text one showed 00:00:00.

       I changed the time field to a text field, kept the default of 0:00, and the text box displayed 0:00. Both of the Expression Boxes also showed 0:00. I went into Preview mode and everything was the same. When I entered 2:32 into the text box and tabbed out of it, the text box and the time-formatted Expression Box showed 2:32:00 AM and the text-formatted Expression Box showed 02:32:00.

       Something's going on.

    Chris
     


     

  • 05-06-2008 04:00 PM In reply to

    Re: Warning: changing a field from time to text

    XML Standards require time to be in the format of "HH:MM:SS" (with timezone info as optional). Thus, when you have the node set to the Time data type, InfoPath does conversion for you to get a valid time enty. When the node is a String data type, InfoPath will make no such conversion attempt.

    This is expected behavior.

    When you dropped the Text Box or Expression Box (bound to the Time data typed node) into the view, InfoPath is smart enough to assume you want to show it with time formatting. Therefore it defaults the format to Time. You can go in and change this default to Text formatting, and then it will show "00:00:00" instead of "12:00:00 AM".

    This is expected behavior.

    If you drop a Text Box or Expression Box (bound to the String data typed node) into the view, InfoPath will will assume that the field content will be a string value and will therefore use text formatting. This too can be changed.

    This is expected behavior.

    The benefit of using the Time data type as opposed to the Text data type is that you get all the built-in conversion and validation. This is a huge benefit if you are really tracking time. If you don't like the way it is being displayed, go into the properties and change the formatting to something you like.

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