set date field default value from three other fields? - InfoPath Dev
in

InfoPath Dev

set date field default value from three other fields?

Last post 12-09-2011 06:06 AM by Jimmy. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 12-07-2011 10:53 AM

    • ehaze
    • Top 500 Contributor
    • Joined on 12-11-2007
    • Posts 49

    set date field default value from three other fields?

    month = 01
    day = 01
    year = 2012

    I need to set a date field equal to the values above.
    When I tried a concat statement, the date field is outlined in red and says 'Only date allowed'.
    concat(../my:Month, "/", ../my:Day, "/", ../my:Year)
  • 12-07-2011 11:31 AM In reply to

    Re: set date field default value from three other fields?

    Give concat(../my:Year, '-', ../my:Month, '-', ../my:Day) a try.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-08-2011 08:51 AM In reply to

    • ehaze
    • Top 500 Contributor
    • Joined on 12-11-2007
    • Posts 49

    Re: set date field default value from three other fields?

    same error.

    month is a string value (01)
    day is a string value (01)
    year is a string value (11)

    concat(../../../my:Month, "-", ../../../my:Day, "-", ../../../my:Year)

    Format of the Date field is MM/DD/YY
  • 12-08-2011 12:26 PM In reply to

    Re: set date field default value from three other fields?

    In your first post, you said year is 2011, and in the new post you said it's 11.  Is it 4 digits or 2? 

    And your first post had ../ before the fields, but the new one has ../../../.  Why the change?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-09-2011 05:59 AM In reply to

    • ehaze
    • Top 500 Contributor
    • Joined on 12-11-2007
    • Posts 49

    Re: set date field default value from three other fields?

    I was trying different formats to see if one worked better than the other.
  • 12-09-2011 06:06 AM In reply to

    Re: set date field default value from three other fields?

    Well, my formula should work as long as the year is 4 digits and the month and day are 2 digits.  If they're not, you'll need to add the 20 or leading 0 to sure them up.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.