Calculation with dates - InfoPath Dev
in

InfoPath Dev

Calculation with dates

Last post 01-03-2011 12:58 AM by Joern. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 09-29-2010 09:00 AM

    • Joern
    • Top 150 Contributor
    • Joined on 09-28-2010
    • Posts 79

    Calculation with dates

    Hello All,

    I want to offer a form in which my colleagues can choose the month of reporting via a dropdown-list (as text). I propose them a couple of months like "September 10", "October 10", "November 10", "December 10".

    What I want to have then, is, that once they've chosen a month from the dropdown-list, two other description fields should reproduce the two following months, e.g. when the user picked "October 10" the two description fields should reproduce "November 10" and "December 10".

    Moreover, is it possible to do so with different years like if they pick "November 10"? The two description field should reproduce  "December 10" and "January 11"?

    I would be very glad for any hints or experiences to solve that problem. Maybe it doesn't even figure?

  • 09-29-2010 09:58 PM In reply to

    This form employs a lot of tricky techniques to dynamically generate the list of months, but I believe what you are looking for is something like the attached.

     This form automatically populates the dropdown with the 8 months starting with the current month (you can see it change if you change your computer's date and re-preview the form).  Are you going to want something like that? What are the criteria for the list of months?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-29-2010 11:01 PM In reply to

    • Joern
    • Top 150 Contributor
    • Joined on 09-28-2010
    • Posts 79

    Thank you for your quick response.

    Unfortunately I can not open the attached form. But getting the dropdown automatically populated with the 8 forthcoming months sounds great.

    I have to explain in it steps:

    1. In the dropdown the user makes his selection of month (the best would be if the month is displayed like 'October 10', 'November 10', 'December 10', 'January 10', ...)

    2. In a description field underneath the dropdown should be displayed the very next month of the month the user selected in the dropdown.

    3. In a second description field should be displayed the next month.

    e.g.: dropdown = 'November 10'; first description field = 'December 10'; second description field = 'January 11'

    Is it possible to make something like that?

    Thank you very much in advance.

  • 09-29-2010 11:12 PM In reply to

    The form atttached is an InfoPath 2007 form.  Did you try opening it in Design mode? Right click in Windows Explorer->Design?   Do you have InfoPath 2003?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-29-2010 11:19 PM In reply to

    • Joern
    • Top 150 Contributor
    • Joined on 09-28-2010
    • Posts 79
    yap, I have InfoPath 2003, sorry
  • 09-30-2010 01:16 AM In reply to

    Here's the same form, saved for IP 2003.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-30-2010 02:57 AM In reply to

    • Joern
    • Top 150 Contributor
    • Joined on 09-28-2010
    • Posts 79
    Great!!! That is exactly what I am looking for. How can I do that with the index etc.?
  • 09-30-2010 09:33 AM In reply to

    You can save the form as its source files to get the file called Months (no extension) and add this to your own form as an XML data source.

    Then duplicate all of the form's rules in your own form (there are rules on Form Load,  and the @init, MonthChoice, and Month fields).

    You also need to set up filtering on the dropdown box so it hides the last two options. (You can see how to do this in my form).

    You can increase or decrease the number of dropdown options by adding or removing MonthChoice nodes in the Months file.  The number of nodes should be 2 more than the number of options you want to provide.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-15-2010 08:06 AM In reply to

    • Joern
    • Top 150 Contributor
    • Joined on 09-28-2010
    • Posts 79

    Hello,

    sorry, was quite busy lately doing other stuff.

    I have changed your form to a .cab-file and put the file called Months (no extension) to my desktop as a xml.-file. Then, I created a data connection from my form with that very xml.-file. After that, I copied every rule you had in your form (still I do not know what you mean with Form Load).

    Then I set the two rules in the dropdown list so that it populates the other two text fields "nextmonth" and "nextnextmonth".

    In my opinion I have done exactly the same you told me to do but when I click on the dropdown list it only shows blank rows....I do not know what I have done wrong.

     

    May I please ask you to help me out?

    Please do not hesitate for further inquiries if necessary.

    Thank you very much in advance.

  • 10-15-2010 08:28 AM In reply to

    Sounds like you're missing the Form Load rule.  This can be found under Tools->Form Options->Open and Save->Rules... in IP 2007.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-22-2010 02:32 AM In reply to

    • Joern
    • Top 150 Contributor
    • Joined on 09-28-2010
    • Posts 79

    Hi,

    now it works great. Exactly the way I want it. Thank you very very much.

    I saw that you have used following-sibling to get the next month.

    In an other field I want to have the month before that month I chose from the dropdown-list, so I copied the rule you created to get the next month and just changed following-sibling in preceding-sibling. But now, I saw that, if I choose the current month the preceding-sibling field remains blank. Only, when choosing a month after the current month the preceding-sibling field is showing the correct previous month. Can you help me on that issue?

    Thank you very much in advance.

  • 01-03-2011 12:58 AM In reply to

    • Joern
    • Top 150 Contributor
    • Joined on 09-28-2010
    • Posts 79

    Hello All,

    regarding above mentioned issue I was asked to do the following adjustement:

    Currently, a dropdown-field is populated with the current month and the two following months.

    Now, the dropdown-field should be populated with the previous month, the current month and the two following months.,

    Unfortunately, I do not know how to achieve that and would be very grateful for any assistance from your side.

    Thank you very much in advance.

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