Retrieving The Current Month Number - InfoPath Dev
in

InfoPath Dev

Retrieving The Current Month Number

Last post 07-10-2013 04:31 AM by Moe1950. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-08-2013 05:11 AM

    Retrieving The Current Month Number

    I'm using InfoPath 2007

    I have a textbox with the following as a default value:   substring(today(), 6, 2)

    I created and published this form last month in June.

    I expected when July 1st rolled around the current month number would change from 06 to 07, but, in the published form, it does not.    In the published form the current month number is still 06

    If I run this form in design/preview the current month number shows up correctly as 07, but it remains 06 in the published form.    I don't have to republish this form every month do I?

    How do I get the month number to change in a published form with each new month?

  • 07-08-2013 09:32 AM In reply to

    Re: Retrieving The Current Month Number

    Does this happen when you reopen a submitted form, or upon opening a new, blank form? I would think this might occur in the former case, but would not expect it in the latter.

    One surefire solution would be to add a Form Load rule that sets the value of that textbox to substring(today(), 6, 2).

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-08-2013 09:54 AM In reply to

    Re: Retrieving The Current Month Number

    Yes, it is submitted.The situation is that I have an application where a number of people have to report on their progress of assigned tasks.   Each month requires an update.   When the update is complete the name of the month is selected from a dropdown, and a new entry is made in the backend SharePoint library based on the contents of the info path form.    One of the "must have" requirements was that prior month entries cannot be changed.   My month drop down displays a month name and has the month number as its corresponding value.    Prior month entries can be viewed, but not modified in any way.   So, when a month name is selected from the dropdown I grab the corresponding value and compare it to the month number of the textbox.   The month number of the textbox is supposed to house the current month number.   If the month number from the dropdown selection is less than the current month number I disable the submit button.The problem is that on all of my submitted forms the month number is still 06 even though the current month is 07.  

    This means that last month’s entries could be modified if someone so desired and this is a very large bug in the application (it was rolled out for the first time last month)

     

    I've never done a Form Load rule before.    How would I do that?

     

  • 07-09-2013 12:39 PM In reply to

    Re: Retrieving The Current Month Number

    If you're using InfoPath 2010, you can add a Form Load rule by going to the Data tab and clicking the Form Load button. Here you can add a rule just like any other rule, to set this field's value. If you give it the condition [MonthField is blank], then it will only set the field the first time the form is opened.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-09-2013 03:29 PM In reply to

    Re: Retrieving The Current Month Number

    Jimmy:
    If you're using InfoPath 2010
    Please see my original post....I'm using Info Path 2007

    Does this leave me with the sole option of republishing my forms each month so the month number will change?

  • 07-09-2013 03:32 PM In reply to

    Re: Retrieving The Current Month Number

     You can add a form load rule in IP 2007. Tools > Form Options > Open and Save, I believe.

    Hilary Stoupa

  • 07-10-2013 04:31 AM In reply to

    Re: Retrieving The Current Month Number

    Hilary Stoupa:
    You can add a form load rule in IP 2007. Tools > Form Options > Open and Save, I believe.
    Beautiful!!!!

    Thank you thank you thank you.

    You just got added to my Christmas card list!    That works just as I hoped!

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