Reset project number if it's the start of a new month. - InfoPath Dev
in

InfoPath Dev

Reset project number if it's the start of a new month.

Last post 04-29-2009 04:37 PM by Samir Farid. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-26-2009 08:20 PM

    Reset project number if it's the start of a new month.

    Hello again,

         Thanks in advance for any help on this one.

         I have a form in which I create the project ID based on the last two digits of the year, then the month, and then a three digit incremental counter, all concatenated.  So a form entered on April 24th would be 0904017 if 16 other forms have already been created in April.  Now, the incremental counter needs to reset back to 1 at the beginning of a new month and I am having some trouble getting this to work.  So the first project entered in May should reset to 0905001. 

         Is there any function to subtract a month in xddate?  I know that you can use xddate:adddays(date, x) to add days, but I need to subtract the month to see if the last project ID was for last month or not. 

         Anybody have any suggestions on resetting this counter effectively?

     

    Thanks for your help,

             Brett

  • 04-29-2009 09:57 AM In reply to

    Re: Reset project number if it's the start of a new month.

    Hey Brett,

    Can't you just get today's date and check whether the day value is 1. If it is 1 then you reset your counter.

    This function will get the day for you.

    substring(xdDate:Today(), 9, 2)

    Regards,

    Samir

  • 04-29-2009 10:07 AM In reply to

    Re: Reset project number if it's the start of a new month.

    Hello Samir,

          Thank you for your reply.  Yes, that will work except for one issue, if I add that rule it will reset the counter for every project opened that day.  I need some way to tell it to only do it for the first document opened that day.

     

    Thanks,

        Brett

  • 04-29-2009 04:37 PM In reply to

    Re: Reset project number if it's the start of a new month.

    Brett,

    The only possible way I can think of is trying to store a variable in a file outside InfoPath. Xml would probably be the best. Then you can use a Secodary Data Source to receive data from that xml file and check the variable. For example, if the variable is True then a project has already been updated with a new project ID.

    Regards,

    Samir

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