previous Month - InfoPath Dev
in

InfoPath Dev

previous Month

Last post 03-02-2010 08:40 AM by dgelosini. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-01-2010 07:27 AM

    previous Month

    I'm trying to insert in a form a fields where  is set the previous month, but i've problem to do this, have you a suggestion?

  • 03-01-2010 08:06 AM In reply to

    To get the number of the previous month, this formula should do the trick:

    (substring(xdDate:Today(), 6, 2) - 1) mod 12 + (substring(xdDate:Today(), 6, 2) = 1) * 12

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-02-2010 07:53 AM In reply to

    Can you explain me the mod 12 entry?

    I don't understand because you use the (substring(xdDate:Today(), 6, 2) = 1) * 12, maybe i don't undersatnd the logic of mod 12.......

    Please forgive my poor know how of xpath.

  • 03-02-2010 08:11 AM In reply to

     I can try to explain how it works if you really need to know, but that formula should work just the way it is without any modification.

     But on second thought, the mod 12 part is unnecessary.  This should work just as well:

    (substring(xdDate:Today(), 6, 2) - 1) + (substring(xdDate:Today(), 6, 2) = 1) * 12

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-02-2010 08:19 AM In reply to

    this should worhk after the change of the year?

    If i change the date of my computer, and now is January that is 1 the previous should be 12 so December it works so. 

  • 03-02-2010 08:21 AM In reply to

     Yes, it should work that way.  Feel free to try it out.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-02-2010 08:40 AM In reply to

    great it works very well, thanks

    If do not disturbe can give me a site or a book for to learn the xpath language for to understand well thath you made for me.

    also thanks

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