Slight error in my timesheet form -1

  • princess5510
    Asked on March 13, 2021 at 3:55 AM

    Here is a link to my timesheet form that i was asked to create for my college.

    https://www.jotform.com/build/210670770585459

    Please clone it.

    According to the form when students enter their clock in and clock out.

    The time should be calculated below in the total hours column.

    I have done the epoch calculations and i have done all the steps for the time calculation procedures.

    However there still seems to be error.

    When i enter clock in clock out and fill all session details for the first row it doesnt calculate for day 1?

    It expects to fill the entire table for it to calculate each day's time calculation.

    Can anybody help?

    Please

  • Basil JotForm Support
    Replied on March 13, 2021 at 3:07 PM

    Hi,

    I have cloned the form and the calculation works as long as you enter the date for the day you are filling.

    1615665934 604d1b0e613d3 chrome GeP9CPdy Screenshot 10

    1615665954 604d1b229392d chrome HymCE8tn Screenshot 21

    Although, It seems there is an issue with the calculations equation.

    Could you explain how the equation is supposed to work?

    Please let us know if you require any further assistance.

  • princess5510
    Replied on March 15, 2021 at 1:47 AM

    Yes. Even when i fill the date text field, sometimes it doesnt work??

    In the screenshots you posted, the day 2 hours are being shown as -9??

    which is completely wrong??

    i have used the same conditions for day 1 and day 2. then what is the issue?


    • Basically there are 9 conditions for each day to calculate the hours which should be shown in the text fields below the session table and also the results table at the very bottom.
    • I have not produced the conditions i have only cloned it from another form.
    • Please ask an expert to help.
  • Bojan Support Team Lead
    Replied on March 15, 2021 at 8:04 AM

    Greetings.

    Have you updated your form? I have tested few fields, and the calculations are correct:

    screenshot 4246 Screenshot 10

    These are the results:

    screenshot 4247 Screenshot 21

    Currently, you have conditions enabled only for these 3 fields. The results are showing as fractions (for the second day, 1.25*60 is 75 minutes, which is 1:15 when converted to hours).

    If you need to get hours and minutes, you will need to add additional 3 calculation fields. The first two will be used to calculate hours and minutes, and the final one will combine those two.

    To calculate the hours, you need to use the floor function on the Day 1 field (please note that I have renamed Day 1 Hours to Day 1 Total):

    screenshot 4248 Screenshot 32

    To calculate the minutes, you first need to multiply the total by 60, to get the selected time in minutes. Then, you need to subscript that from the result of the multiplication of total hours and 60. This will only give the selected number of hours. The difference in the selected minutes:

    screenshot 4249 Screenshot 43

    The final field will simply join these two together, so they are easier to read:

    screenshot 4250 Screenshot 54

    I have added these on the cloned form, you can test it here:
    https://form.jotform.com/210733092392957

    You will need to do this for every field you have, I have only done it for day one. You can also hide helper fields by right-clicking on them, however, I didn't so you can see the results.

    So, if someone enters this:

    screenshot 4251 Screenshot 65

    The final result will be:

    screenshot 4252 Screenshot 76

    Let us know if this solution works for you.