After calculating date field validation error in Infopath Designer - InfoPath Dev
in

InfoPath Dev

After calculating date field validation error in Infopath Designer

Last post 05-11-2015 06:04 AM by adit123. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 05-07-2015 01:03 PM

    After calculating date field validation error in Infopath Designer

    I am trying to do a calculation where the date always gets calculated to the 30th of a month so, I am using this formula in a text box,

    concat(substring(Calculated Cal. Due Date, 7, 1), "/30/", substring(Calculated Cal. Due Date, 1, 4))

    Then I created a Date picker box and in it's default value, I made it equal to the text box, however I am receiving a validation error where it is showing red dashes around the Date Picker box. Also when a calculation is made, it is in the correct format , "mm/dd/yyyy". Even with the consistent formatting, there is a red dash , showing a validation error. I am not sure what i am doing wrong.

  • 05-07-2015 02:05 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    Regardless of how a date is displayed on the form (the formatting settings) the format for a date datatype in XML is:

    yyyy-MM-dd

    So, you want both of the characters for month instead of just one, and you want year, then month, then "30", all hyphen separated.

    Look at an XML file in a text editor and you'll see how the dates are formatted.

    DateTime format (for completeness):

    yyyy-MM-ddThh:mm:ss

    Hilary Stoupa

  • 05-07-2015 02:27 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    Sorry, I should clarify more. I basically want to replace the day, from a calculated text box field which is in yyyy-MM-ddThh:mm:ss , and now I want to replace it with the day 28. I realized February would not have 30 days.  So once  I replace the day using this function:

    concat(number(substring(Calculated Cal. Due Date,6,2))), "/28/", number(substring(Calculated Cal. Due Date, 1,4))) 

     , I set the default value of a Date type field equal to the text box where I replaced the day with the 28.

  • 05-07-2015 02:33 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    And what I am saying is that you get a validation error because your formula is not returning a correctly formatted date.

    concat(substring(Calculated Cal. Due Date, 1,4), "-", substring(Calculated Cal. Due Date,6,2), "-28")

    Hilary Stoupa

  • 05-07-2015 02:40 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    I placed in your function, but I am still receiving the validation error :( . Now it is just showing up as "2016-05-28" . Is this because the Date type box sees this as a string rather than an actual date?

  • 05-07-2015 02:48 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    What is the data type of the field you are trying to set with this rule? Date or Date Time?

    Hilary Stoupa

  • 05-07-2015 02:52 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    Correct. So I have two fields. One is a text box where I set a rule and does the replacing of the day, so using your function. and then the other is a "Date Only" field where in the default value I just make it equal to the text box field. I am not sure where I am going wrong with this. I also tried the your formula directly on the Date Only field and received the same validation error.
  • 05-07-2015 02:58 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    Can you attach your template under the options tab in a reply?

    Hilary Stoupa

  • 05-07-2015 03:15 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    Hello Hilary, so I was replicating the form in a blank infopath filler, and when i was applying the same rules, it worked! I can not send you my acutal form due to privacy issues , but my form is created through Sharepoint maybe that is why I am receiving such a validation error? In the blank Infopath Filler form, it was completely fine! No validation error. This is strange. Any reason why you think this is happening?
  • 05-07-2015 03:18 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    So, when you say "my form is created through SharePoint" do you mean this is a list form?

    If so, I'd assume that any date field is actually a date time.

    Try adding "T00:00:00" to the end of your concat formula and see what happens.

    Hilary Stoupa

  • 05-07-2015 03:22 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    Oh is that the default setting through SP? Okay I will try this . Thank you!
  • 05-07-2015 03:32 PM In reply to

    Re: After calculating date field validation error in Infopath Designer

    SharePoint lists will let you display a date time as a date only value - but in the end, the data type is date time.

    Hilary Stoupa

  • 05-11-2015 06:04 AM In reply to

    Re: After calculating date field validation error in Infopath Designer

    Thank you! It worked perfectly!

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