Date format inconsistent in InfoPath 2010. - InfoPath Dev
in

InfoPath Dev

Date format inconsistent in InfoPath 2010.

Last post 07-11-2012 08:36 AM by Hilary Stoupa. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 07-05-2012 12:53 PM

    • pauls
    • Not Ranked
    • Joined on 02-09-2012
    • Posts 12

    Date format inconsistent in InfoPath 2010.

    Date format inconsistent in InfoPath 2010.I have an interesting problem that seems to be a bug in InfoPath 2010. I have one data entry view and two print view reports. The date field on the schema is Data type: Text (string). The input field is a Date Picker, Date type: text (string), Format…: “*3/14/2001”. The problem is one of the print view reports is formatting the date with time in it, the other print view report is fine. I have checked all the settings and recreated the field but I can’t get Report 2 to format the data as M/D/YYYY.Data entry date pickerReport 1 is fineReport 2 is not

     


  • 07-06-2012 04:59 AM In reply to

    Re: Date format inconsistent in InfoPath 2010.

    Are both dates displayed using the same type of control? (i.e. are both text boxes? or are both Calculated values? )

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


  • 07-06-2012 08:40 AM In reply to

    • pauls
    • Not Ranked
    • Joined on 02-09-2012
    • Posts 12

    Re: Date format inconsistent in InfoPath 2010.

    Hi ErnestoM,

    Yes, both the reports are TextBoxes that use the "Text (string)" data type. They all reference the same Schema Field of course. The funny thing is if I retype the dates on the problem report that fixes the problem. But we have many reports and we shouldn't have to go into each one to retype the dates.

     Thanks.

  • 07-06-2012 09:52 AM In reply to

    Re: Date format inconsistent in InfoPath 2010.

    What is setting the date fields? Are there any rules setting them? Any default values?

    Hilary Stoupa

  • 07-10-2012 08:51 AM In reply to

    • pauls
    • Not Ranked
    • Joined on 02-09-2012
    • Posts 12

    Re: Date format inconsistent in InfoPath 2010.

    Hi Hillary,

    The date field is set by the date entry picker. There are no rules or default values setting it. The two reports are just text (string) fields that reference the schema field. I have several other fields like this one but this is the only one that is showing the date format as 2012-07-13T00:00:00.

    I had said in an earlier post that if you retype the date in the report it fixes it but that is not correct, if I go back to the date picker and change the date then the report takes on the time format again: 2012-07-13T00:00:00.

  • 07-10-2012 10:33 AM In reply to

    Re: Date format inconsistent in InfoPath 2010.

    So when you say

    pauls:
    text (string) fields that reference the schema field

    What does that mean? You have a couple of string fields that are using other fields for their default values? What are the data types ofr the date fields? Is one a Date Time, perhaps?

    Hilary Stoupa

  • 07-10-2012 11:43 AM In reply to

    • pauls
    • Not Ranked
    • Joined on 02-09-2012
    • Posts 12

    Re: Date format inconsistent in InfoPath 2010.

    Hi Hillary,

    I have a field called "PaperPresentationDatePresented", this is a "Text (string)". I have a data entry view where that field is represented as a Date Picker control. I have two reports where that field is displayed as a Text Box. There are no rules, default values, or formatting set. The user enters the date with the date picker. In the first report the date is displayed as M/D/YYY, Example: 7/12/2012. In the second report the date is displayed as YYYY-MM-DD time, Example: 2012-07-12T00:00:00. I want the second report to display the date like the first report but its not doing it. There are screen shots of all this in my first post. None of the fields are date time.

    I've recreated the control and retyped the date but can't seem to fix the problem.

  • 07-10-2012 12:02 PM In reply to

    Re: Date format inconsistent in InfoPath 2010.

    Care to attach your form template to a reply under the options tab?

    Hilary Stoupa

  • 07-10-2012 01:49 PM In reply to

    • pauls
    • Not Ranked
    • Joined on 02-09-2012
    • Posts 12

    Hi Hilary,

    I've attached a small version of our template to fit under 128K limit. To duplicate the problem:

    1. Preview the form 
    2. Go to the "5.Presentation-Talks" view
    3. Enter some text and dates for the last two sections on that view: "D. Other venues" and "Paper Presentations..."
    4. Click the Reports button
    5. Click the "View Faculty Report" button and scroll down to "Presentation and Talks" section and note the date format for "Paper Presentations..." is yyyy-mm-dd. This is not what we want, this is the problem.
    6. Click the "View Deans Report" and note the identical sections have the dates formatted correctly.
  • 07-10-2012 02:55 PM In reply to

    Re: Date format inconsistent in InfoPath 2010.

    So, the behavior you describe as problematic is actually the behavior I'd expect - since the data type is string, in a text box control, you can't set the format desired (like you can in the date picker control). If you change those text boxes to calculated values (expression boxes), you'd be able to set the format. The XML is going to store the date value as yyyy-mm-dd - that's displayed in the top portion of the screen shot I've attached.

    I saved the form as source files and looked at one of controls in one of the views that is displaying the data as a formatted date - it is odd, it has an xd:datafmt attribute on it - which I would not expect, since on the control, the Format button is disabled.

    You could manually modify the veiw to include the attribute on the text box controls you wish to have formatted like this  - but really, why not just change the field to a date data type? Then you could format the text boxes as desired?


    Hilary Stoupa

  • 07-11-2012 06:13 AM In reply to

    • pauls
    • Not Ranked
    • Joined on 02-09-2012
    • Posts 12

    Re: Date format inconsistent in InfoPath 2010.

    Hi Hilary,

    How did you open the infopath form to view the xml like that? That's what I wanted to look at because I knew InfoPath was stubbornly putting an unwanted date format on that field even though I told it not to.

  • 07-11-2012 06:20 AM In reply to

    • pauls
    • Not Ranked
    • Joined on 02-09-2012
    • Posts 12

    Re: Date format inconsistent in InfoPath 2010.

    Hi Hilary,

    We can't change those fields to date data type because we are using this Muhimbi software (http://blog.muhimbi.com/2012/02/convert-infopath-to-ms-word-excel-xps.html) to convert the InfoPath forms to Word documents and they have an issue with date picker fields, I listed the reason below. I suppose I could make a text field that gets the value from the date picker field.

    1. Missing ‘year’ in date picker fields: Due the way the Date Picker is structured internally, modifying its width does not translate properly when displayed in MS-Word. To solve this change the date picker field to a regular text field either by creating a conversion specific view, or using a display rule.
    2.  
  • 07-11-2012 07:14 AM In reply to

    • pauls
    • Not Ranked
    • Joined on 02-09-2012
    • Posts 12

    Re: Date format inconsistent in InfoPath 2010.

    Hi Hilary,

    I tried your suggestion of changing the text box to a calculated value and that seems to have fixed the issue.

    Thanks

    Paul

  • 07-11-2012 08:36 AM In reply to

    Re: Date format inconsistent in InfoPath 2010.

    I saved the form as source files - for IP 2010, that is under Publish. I use 7-zip and just extract directly from XSN usually, since it is quicker.

    Hilary Stoupa

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