Hi,
I am trying to create a very simple attendance record form for the field
staff. The user needs to enter in-time and out- time. Now I know, that the
hours between two time cannot be calculated by using double() function
with "time" and "date" questions. How else can I calculate the hours
between two entered time?
I don't want to use two forms for in time and out time
Best-
William,
I have already read this. But it is not working for "time " and "date"
questions. Can you specifically give me the functions to calculate the time
difference.
-Ruchi
···
On Wednesday, September 2, 2015 at 9:43:24 AM UTC+5:30, Ruchi Deshpande wrote:
>
>
> Hi,
>
> I am trying to create a very simple attendance record form for the field
> staff. The user needs to enter in-time and out- time. Now I know, that the
> hours between two time cannot be calculated by using double() function
> with "time" and "date" questions. How else can I calculate the hours
> between two entered time?
> I don't want to use two forms for in time and out time
>
> Best-
>
Ruchi,
Please check out this documentation <http://Using the now function to do
calculations with time>, particularly the section titled "Using the now
function to do calculations with time"
Best,
Will
···
On Wed, Sep 2, 2015 at 12:13 AM, Ruchi Deshpande < ruchi.deshpande@snehamumbai.org> wrote:
Hi,
I am trying to create a very simple attendance record form for the field
staff. The user needs to enter in-time and out- time. Now I know, that the
hours between two time cannot be calculated by using double() function
with "time" and "date" questions. How else can I calculate the hours
between two entered time?
I don't want to use two forms for in time and out time
Best-
--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi William,
I think that this does not work with the "time" and "date" questions. Also,
I will have to create two forms for capturing date and time by "now()".
Which I don't want to do. Am I correct?
I am pasting this text from the link you sent me -
- "Note that this does not currently work with "time" or "date time"
question types in the form builder."
I want to know other than using now() how can I subtract two times. Or is
there a way by which I can use now() in one single form?
Best-
Ruchi
···
On Wednesday, September 2, 2015 at 9:43:24 AM UTC+5:30, Ruchi Deshpande wrote:
>
>
> Hi,
>
> I am trying to create a very simple attendance record form for the field
> staff. The user needs to enter in-time and out- time. Now I know, that the
> hours between two time cannot be calculated by using double() function
> with "time" and "date" questions. How else can I calculate the hours
> between two entered time?
> I don't want to use two forms for in time and out time
>
> Best-
>
Dear Ruchi,
I have a similar function in my application where i calculate the time
difference between a clock in and clock out. This is how I have done it;
- Create a hidden value in the time in form and set the calculate
condition to double(now())
- save this hidden value to the case property (example time _in)
- in the time out form create a hidden value (hv_time_in)and load the
time_in property to the hidden value
- Create another hidden value (called calc_hours_worked) and type the
following into the calculate condition; int(/data/hv_time_in * 24) +
((int(((/data/hv_time_in * 24) - int(/data/hv_time_in * 24)) *60)) div 60)
This will calculate the time difference between the time the person filled
in the time in form and the time out form and will accommodate time periods
longer than 24 hours.
Hope this helps
Kind regards,
Ameera
···
On Wednesday, 2 September 2015 06:13:24 UTC+2, Ruchi Deshpande wrote:
>
>
> Hi,
>
> I am trying to create a very simple attendance record form for the field
> staff. The user needs to enter in-time and out- time. Now I know, that the
> hours between two time cannot be calculated by using double() function
> with "time" and "date" questions. How else can I calculate the hours
> between two entered time?
> I don't want to use two forms for in time and out time
>
> Best-
>
Thanks Ameera for the post. I am aware of this. If I am not wrong for this
you have two forms, one for in-time and one for out -time. I don't want to
do this. Is it possible to it with one single form??
Regards,
Ruchi
···
On Wednesday, September 2, 2015 at 9:43:24 AM UTC+5:30, Ruchi Deshpande wrote:
>
>
> Hi,
>
> I am trying to create a very simple attendance record form for the field
> staff. The user needs to enter in-time and out- time. Now I know, that the
> hours between two time cannot be calculated by using double() function
> with "time" and "date" questions. How else can I calculate the hours
> between two entered time?
> I don't want to use two forms for in time and out time
>
> Best-
>
Whoops - didn't get the link
https://confluence.dimagi.com/display/commcarepublic/Calculations+with+Dates+and+Times
···
On Wed, Sep 2, 2015 at 12:55 AM, William Pride wrote:
Ruchi,
Please check out this documentation, particularly the section titled
"Using the now function to do calculations with time"
Best,
Will
On Wed, Sep 2, 2015 at 12:13 AM, Ruchi Deshpande < ruchi.deshpande@snehamumbai.org> wrote:
Hi,
I am trying to create a very simple attendance record form for the field
staff. The user needs to enter in-time and out- time. Now I know, that the
hours between two time cannot be calculated by using double() function
with "time" and "date" questions. How else can I calculate the hours
between two entered time?
I don't want to use two forms for in time and out time
Best-
--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ruchi,
Can you give the function(s) that you've tried and explain how they're not
working? By converting the date times to doubles, taking the difference
between the two, and then multiplying the difference by 24 you should get
the elapsed hours, similar to how its described here:
- represent the amount of time that has passed, by
calculating: double(now()) - double(/data/log_in_time)
- The result is a decimal value in days/fractions of days. To convert to
hours and minutes, you can do the following calculations:
- int(/data/time_worked * 24)
Best,
Will
···
On Wed, Sep 2, 2015 at 2:01 AM, Ruchi Deshpande < ruchi.deshpande@snehamumbai.org> wrote:
William,
I have already read this. But it is not working for "time " and "date"
questions. Can you specifically give me the functions to calculate the time
difference.
-Ruchi
On Wednesday, September 2, 2015 at 9:43:24 AM UTC+5:30, Ruchi Deshpande wrote:
Hi,
I am trying to create a very simple attendance record form for the field
staff. The user needs to enter in-time and out- time. Now I know, that the
hours between two time cannot be calculated by using double() function
with "time" and "date" questions. How else can I calculate the hours
between two entered time?
I don't want to use two forms for in time and out time
Best-
--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Ruchi,
We do currently support the kind of simple subtraction you're looking for
with dates and now, but unfortunately not for the "time" question type -
this is something we intend to better support in the future, but we
currently do not have any timelines for that work.
Do you need the time between in/out for use in the application itself, or
for data analysis later? If you do not need it in the application, you can
figure out the time between with an excel formula after you export the data.
If you do need it in the app, there are some potential workarounds. For
example, if you know that in-time and out-time will be restricted to the
same day, you could use a dropdown for them to choose the times to the
nearest hour/half hour and figure out the hours between by finding the
difference between the choice values.
Amelia
···
On Thu, Sep 3, 2015 at 1:04 AM, Ruchi Deshpande < ruchi.deshpande@snehamumbai.org> wrote:
Hi William,
I think that this does not work with the "time" and "date" questions.
Also, I will have to create two forms for capturing date and time by
"now()". Which I don't want to do. Am I correct?
I am pasting this text from the link you sent me -
- "Note that this does not currently work with "time" or "date time"
question types in the form builder."
I want to know other than using now() how can I subtract two times. Or is
there a way by which I can use now() in one single form?
Best-
Ruchi
On Wednesday, September 2, 2015 at 9:43:24 AM UTC+5:30, Ruchi Deshpande wrote:
Hi,
I am trying to create a very simple attendance record form for the field
staff. The user needs to enter in-time and out- time. Now I know, that the
hours between two time cannot be calculated by using double() function
with "time" and "date" questions. How else can I calculate the hours
between two entered time?
I don't want to use two forms for in time and out time
Best-
--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
HI Ruchi,
Yes I have two forms; one clock in and one for clock out. but you can still
use the calculation if you have one form. From step 3 - instead of
creating the hidden value in the second form create it in the form you are
using.
Let me know if i need to clarify this more.
Kind regards,
Ameera
···
On Thursday, 10 September 2015 10:47:31 UTC+2, Ruchi Deshpande wrote:
>
> Thanks Ameera for the post. I am aware of this. If I am not wrong for this
> you have two forms, one for in-time and one for out -time. I don't want to
> do this. Is it possible to it with one single form??
>
> Regards,
> Ruchi
>
> On Wednesday, September 2, 2015 at 9:43:24 AM UTC+5:30, Ruchi Deshpande wrote:
>>
>>
>> Hi,
>>
>> I am trying to create a very simple attendance record form for the field
>> staff. The user needs to enter in-time and out- time. Now I know, that the
>> hours between two time cannot be calculated by using double() function
>> with "time" and "date" questions. How else can I calculate the hours
>> between two entered time?
>> I don't want to use two forms for in time and out time
>>
>> Best-
>>
>