counting days in-between high and low season

  • aeroloop
    Asked on March 21, 2016 at 8:10 AM

    Probably pretty simple but I can not work it out, I would like to have days calculated giving separate results if they are in low or high season in the calendar, working fine if I just choose low season but can not get both result working if it is in-between the two season range. i.e. 2 days in low season and 3 days in high season giving a total of 5 days all together.

    Thanks for your help 

  • Charlie
    Replied on March 21, 2016 at 9:33 AM

    I'm sorry, I'm quite confused how your form actually works. I see there are conflicting setup you have.

    In your "Low season rental days" and "High season rental days", you are using a form calculation widget and adding fields inside it:

    However, those fields seems to have already been deleted.

    counting days in between high and low season Image 1 Screenshot 40

     

    In your "Total rental days", you also have this formula:

    counting days in between high and low season Image 2 Screenshot 51

     

    However, you also have conditions setup doing almost the same calculations or a different one:

    Condition 1 in your list: Noticed that you are adding "Low season rental days" and "high season rental days" when any of the season rental days are filled out. Remember that you are also subtracting the "To" and "From" date in your "Total rental days" causing a conflict.

    counting days in between high and low season Image 3 Screenshot 62

     

    Please do check your conditions and the calculations you have setup in the form calculation widget to avoid conflicts. Let us know if you need more help on this.

  • aeroloop
    Replied on March 22, 2016 at 12:29 AM

    Ok I will make it more simple so you can understand what I need, check https://form.jotform.me/60808736938469 all I try to do is to have day count result separated for the two periods if I choose a date between high and low period I should get results in the two boxes i.e. 2 days in high and 3 days in low, unfortunately it give no result if I chose date in-between. It is I guess because it will insert to-minus-from into the result which is the total time period how can I separate and fill the right result box. Thanks.

    To0-9 - From0-9
  • Kevin Support Team Lead
    Replied on March 22, 2016 at 12:57 AM

    I'm not sure if understood your request, I understand that you want to get the days between two dates, but you need to split this result in two different calculations based on two periods which are high and low. 

    I think this could be possible to achieve by using conditions as explained by Charlie above, however, I cloned the form you provided and I was unable to apply it, I'm not sure what are you using to take a date as high or low, could you please provide us a bit more about it? 

    Is it between some dates? 

    Is it after some date or before one, I have tested and I got negative results, to instead of get for example 2 days, I got -2 days, something that I think is not logical, but please with a bit more about what are you trying to achieve we should be able to help you. 

  • aeroloop
    Replied on March 22, 2016 at 1:15 AM

    Thanks Kevin_G,

    That is correct, I try to separate te results between low or high period, as you can see I use conditions to separate the dates but I can not get separated result, it is either low or high but not different amount of days separated in "low" amount of days and "high". if I choose dates in low or high section I get the result correctly, if I chose two dates in-between the high and low I get no result. Still I believe that the problem is in the calculation that give a total result between to and from and that this result give the total amount of days. looking for a way to go around it so I can set the rental prices accordingly.

    Calculation widget do not give me the possibility to choose selected dates in different time period.

     

  • Chriistian Jotform Support
    Replied on March 22, 2016 at 2:53 AM

    It seems that only one criteria can be fulfilled in your conditions, which is why only one result is shown (either high or low). So for example if the date is 2016-08-1, and 2016-08-1 is after 2016-06-30, the condition for High will be fulfilled so the result will be shown. However, this does not fulfill the condition for Low because the date 2016-08-1 is not before 2016-07-01 and as such the result will not be displayed for low.

    counting days in between high and low season Image 1 Screenshot 20

    Allow me some time to investigate a possible solution to get both high and low result for in between dates. I will get back to you once I have done so.

    Regards.

  • Chriistian Jotform Support
    Replied on March 22, 2016 at 4:58 AM

    A possible workaround I could suggest would be to add an in-between field that you can use to get the days for in-between high and low season.

    counting days in between high and low season Image 1 Screenshot 40

    Then add a calculate field condition to calculate the number of days between the high season and the low season.

    counting days in between high and low season Image 2 Screenshot 51

    Once the condition is fulfilled if the date is in-between high and low season, the in between field will be filled with the total number of days.

    counting days in between high and low season Image 3 Screenshot 62

    Here's a demo so you can see it in action: https://form.jotform.com/60811787552966

    You can also clone it to your account by following this guide: How to Clone an Existing Form from a URL

    Hope this helps. Do let us know if you need further assistance.
    Regards.

     

  • aeroloop
    Replied on March 22, 2016 at 5:44 AM

    Thanks so much for you help,

    But this is exactly what I do not need, in short all I need to get is  price that will include a total rental cost and will include low season prices with high season prices in the total.

    I will try a different approach to find a solution, in the meantime, do not hesitate to let me know if you have another suggestion to make this form work.

    Thanks a lot again for your great work.

     

  • mert JotForm UI Developer
    Replied on March 22, 2016 at 7:59 AM

    Actually, the solution which has provided by my colleague is very close to the thing you want. With the following conditions, it adds the days to the "high season rental days" or "low season rental days" with respect to the date selection.

     

    For "high season rental days",

    counting days in between high and low season Image 1 Screenshot 40

     

    For "low season rental days",

    counting days in between high and low season Image 2 Screenshot 51

     

    After keeping those values, we can add one "Form Calculation" widget and set the following calculation to get the total price:

    counting days in between high and low season Image 3 Screenshot 62

     

    The "lowPrice" and the "highPrice" on the image are going to be the constants and they will be multiplied with the days from "high season rental days", "low season rental days". I hope this one will meet with your needs.

    If you need any extra information, please do let us know.

     

    Thanks.

  • aeroloop
    Replied on March 27, 2016 at 9:59 PM

    There I find a way to make it work.

    A bit of work, all you need is to add fix dates in-between low and high season, see on this image I call them fixhigh and fixhigh-H or fixlow/fixlow-L for low season to calculate dates before and after the two season dates.

    counting days in between high and low season Image 1 Screenshot 30

    Check the day count as you may need to add a day in the full high season period as the result is from/to without using fixlow or fixhigh dates, as it is a rental I need to count all days included in the result.

    counting days in between high and low season Image 2 Screenshot 41

    You can test this form here

    Thank you all again for you help and work to help making this work.

  • Chriistian Jotform Support
    Replied on March 27, 2016 at 11:29 PM

    I am glad to know that you were able to make the form work. If you have any other concerns, feel free to contact us again. Regards.