Error in string convert (time_type), output showed date

Dear all,

The issue I was trying to solve is:

  • Calculate time difference for scheduled come-back interview that
    requires at least 2 hours apart.

After reading several previous posts regarding duration calculation (Duration
Calculation by Damian
https://groups.google.com/forum/#!searchin/opendatakit/calculate$20time$20difference/opendatakit/yF1CkSvMo4Y/R7q9Qd3DXLwJ),
I came to trial run several calculation test to see output result. I set it
up as following in xls file:

Input time (type= time , name=time)

  1. convert date-time to decimal using: decimal-date-time (${time}) - this
    didn't work out as ODK validate keeps showing error of "type mismatch"

  2. convert time to decimal using: decimal-time (${time}) - this also
    didn't work out as ODK validate keeps showing error of "type mismatch"

  3. convert time to string using:* string (${time}) *- now it gets confused,
    because output show this as a *date string *-format (YYYY - MM - DD)

Additionally, string (${time}) also outputs date string -format (YYYY -
MM - DD)

Can someone help me to understand why this occurs? Because it is not right
when "Input time" shows time as normal. But when I accessed this field for
calculation, then the input changed to date.

Thanks.

PS: I am using ODK Collect 1.4.7(build 1053) on ASUS Fonepad 7", Android 5

Hi Hung,

You using the latest versions of Collect (1.4.7, 1053) and Validate
(1.4.6)? Perhaps you can also attach a sample form so others can help.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Fri, Oct 2, 2015 at 5:20 AM, Hung Pham hpham2709@gmail.com wrote:

Dear all,

The issue I was trying to solve is:

Calculate time difference for scheduled come-back interview that requires at
least 2 hours apart.

After reading several previous posts regarding duration calculation
(Duration Calculation by Damian), I came to trial run several calculation
test to see output result. I set it up as following in xls file:

Input time (type= time , name=time)

  1. convert date-time to decimal using: decimal-date-time (${time}) - this
    didn't work out as ODK validate keeps showing error of "type mismatch"

  2. convert time to decimal using: decimal-time (${time}) - this also didn't
    work out as ODK validate keeps showing error of "type mismatch"

  3. convert time to string using: string (${time}) - now it gets confused,
    because output show this as a date string -format (YYYY - MM - DD)

Additionally, string (${time}) also outputs date string -format (YYYY - MM -
DD)

Can someone help me to understand why this occurs? Because it is not right
when "Input time" shows time as normal. But when I accessed this field for
calculation, then the input changed to date.

Thanks.

PS: I am using ODK Collect 1.4.7(build 1053) on ASUS Fonepad 7", Android 5

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dear Yaw,

Thanks for your reply. I am using Validate (1.4.6) yes.

Please find the attached file on Google Drive: test_function
https://docs.google.com/spreadsheets/d/19QMRQL-UpbpG8iabY4US-423_DhjATY3ygzdp9QR6nM/edit?usp=sharing
I add 2 screen shots of input time and display result on Google Drive as
well : screen shoot 1
https://drive.google.com/file/d/0B78RrlVhNzEZY0NvenZwRjVVb28/view?usp=sharing
screen shoot 2
https://drive.google.com/file/d/0B78RrlVhNzEZTGp1Wkx0TG9iZms/view?usp=sharing

I am going to test decimal-date-time using opendatakit.org/xiframe to see
if that will produce different output. Maybe it can.

Thanks/

Hung

··· On Friday, 2 October 2015 02:18:11 UTC+1, Yaw Anokwa wrote: > > Hi Hung, > > You using the latest versions of Collect (1.4.7, 1053) and Validate > (1.4.6)? Perhaps you can also attach a sample form so others can help. > > Yaw > -- > Need ODK services? http://nafundi.com provides form design, server > setup, professional support, and software development for ODK. > > On Fri, Oct 2, 2015 at 5:20 AM, Hung Pham <hpha...@gmail.com > wrote: > > Dear all, > > > > The issue I was trying to solve is: > > > > Calculate time difference for scheduled come-back interview that > requires at > > least 2 hours apart. > > > > After reading several previous posts regarding duration calculation > > (Duration Calculation by Damian), I came to trial run several > calculation > > test to see output result. I set it up as following in xls file: > > > > > > Input time (type= time , name=time) > > > > > > 1. convert date-time to decimal using: decimal-date-time (${time}) - > this > > didn't work out as ODK validate keeps showing error of "type mismatch" > > > > 2. convert time to decimal using: decimal-time (${time}) - this also > didn't > > work out as ODK validate keeps showing error of "type mismatch" > > > > 3. convert time to string using: string (${time}) - now it gets > confused, > > because output show this as a date string -format (YYYY - MM - DD) > > > > > > Additionally, string (${time}) also outputs date string -format (YYYY - > MM - > > DD) > > > > > > Can someone help me to understand why this occurs? Because it is not > right > > when "Input time" shows time as normal. But when I accessed this field > for > > calculation, then the input changed to date. > > > > > > Thanks. > > > > > > > > PS: I am using ODK Collect 1.4.7(build 1053) on ASUS Fonepad 7", Android > 5 > > > > -- > > -- > > Post: opend...@googlegroups.com > > Unsubscribe: opendatakit...@googlegroups.com > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "ODK Community" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to opendatakit...@googlegroups.com . > > For more options, visit https://groups.google.com/d/optout. >

Dear all,

After extensive testing function calculate, I come to some conclusions with
a hope that if anyone who tries to calculate time difference in XLSForm
will be able to get a more satisfactory result.

  1. My earlier reported Validate error for decimal-date-time is false,
    please discard that issue, I rebuild the sheet, turn off auto_input to
    avoid auto_correcting function that turns lower case 1st letter to upper
    case, etc. in .xls file. It works now.
  2. Time functions work well, but There is a disparity of up to 1 hour
    when try to calculate time difference. This means that if 2 input times
    exactly the same, the difference is 1 hour. The debug this, there is a
    need to understanding the source code /DateUtils @ javarosa / core / src
    / org / javarosa / core / model / utils / DateUtils.java
    https://bitbucket.org/m.sundt/javarosa/src/62409ae3b803/core/src/org/javarosa/core/model/utils/DateUtils.java?fileviewer=file-view-default#cl-247
  3. Please note: 1 hour in decimal will be formatted as 2 hour with the
    source code above
    .
  4. Minute & Second disparity: would be about (+/-)1 minute inaccurate.
    I haven't run detailed test for each calculation in source code, thus
    unable to know for sure of the decimal value of this inaccuracy. But that
    would not matter too much since if you are going to calculate time
    difference, you should factor in such inaccuracy.

So what I did yo fixed this and get a reasonably accurate time difference
calculation.

  • Conditions: use 2 time inputs, 1 for user to input, other to record
    time the input was made (ODK Collect auto record current time when this
    prompt is activated, if you use function now() - it will record the time
    when this form is opened. So not good with recording time to reschedule in
    the middle of an interview).
  • Calculate the difference between these 2 values, then minus 1 hour
    disparity.
  • Format this result to time (you choose what format you want - I prefer
    '%H:%M' , minute will be rounded up/down to account for second difference.

!Note: you will have to convert time variable to decimal by using
decimal-date-time(${variable} (to include date) or decimal-time
(${variable}) to not include time. Else when you do calculation like *time1

  • time2* , it will be* = 0*, and when you do format-date-time for that
    result, it will produce "type mismatch" error.

test_cal_fuct_assign_value.xls (14 KB)

··· --

@ Yaw:

I just read your reply while writing this. Thanks. I got it working now.
Probably I put down wrong syntax.


There is an attachment so you can see what I did to get the desired result.
Output of that file is displayed here: screen shoot 3
https://drive.google.com/file/d/0B78RrlVhNzEZVnRvdlBSNURUYTA/view?usp=sharing

Hung,

decimal-date-time and decimal-time works for me. Try this attached file.

Yaw

datetime.xlsx (32 KB)

··· -- Need ODK consultants? https://nafundi.com provides form design, server setup, in-field training, and software development for ODK.

On Fri, Oct 2, 2015 at 3:19 PM, Hung Pham hpham2709@gmail.com wrote:

Dear Yaw,

Thanks for your reply. I am using Validate (1.4.6) yes.

Please find the attached file on Google Drive: test_function
I add 2 screen shots of input time and display result on Google Drive as
well : screen shoot 1 screen shoot 2

I am going to test decimal-date-time using opendatakit.org/xiframe to see if
that will produce different output. Maybe it can.

Thanks/

Hung

On Friday, 2 October 2015 02:18:11 UTC+1, Yaw Anokwa wrote:

Hi Hung,

You using the latest versions of Collect (1.4.7, 1053) and Validate
(1.4.6)? Perhaps you can also attach a sample form so others can help.

Yaw

Need ODK services? http://nafundi.com provides form design, server
setup, professional support, and software development for ODK.

On Fri, Oct 2, 2015 at 5:20 AM, Hung Pham hpha...@gmail.com wrote:

Dear all,

The issue I was trying to solve is:

Calculate time difference for scheduled come-back interview that
requires at
least 2 hours apart.

After reading several previous posts regarding duration calculation
(Duration Calculation by Damian), I came to trial run several
calculation
test to see output result. I set it up as following in xls file:

Input time (type= time , name=time)

  1. convert date-time to decimal using: decimal-date-time (${time}) -
    this
    didn't work out as ODK validate keeps showing error of "type mismatch"

  2. convert time to decimal using: decimal-time (${time}) - this also
    didn't
    work out as ODK validate keeps showing error of "type mismatch"

  3. convert time to string using: string (${time}) - now it gets
    confused,
    because output show this as a date string -format (YYYY - MM - DD)

Additionally, string (${time}) also outputs date string -format (YYYY -
MM -
DD)

Can someone help me to understand why this occurs? Because it is not
right
when "Input time" shows time as normal. But when I accessed this field
for
calculation, then the input changed to date.

Thanks.

PS: I am using ODK Collect 1.4.7(build 1053) on ASUS Fonepad 7", Android
5

--

Post: opend...@googlegroups.com
Unsubscribe: opendatakit...@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google
Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send
an
email to opendatakit...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fantastic write up, Hung!

Yaw

··· -- Need ODK consultants? https://nafundi.com provides form design, server setup, in-field training, and software development for ODK.

On Fri, Oct 2, 2015 at 7:50 PM, Hung Pham hpham2709@gmail.com wrote:

Dear all,

After extensive testing function calculate, I come to some conclusions with
a hope that if anyone who tries to calculate time difference in XLSForm will
be able to get a more satisfactory result.

My earlier reported Validate error for decimal-date-time is false, please
discard that issue, I rebuild the sheet, turn off auto_input to avoid
auto_correcting function that turns lower case 1st letter to upper case,
etc. in .xls file. It works now.
Time functions work well, but There is a disparity of up to 1 hour when try
to calculate time difference. This means that if 2 input times exactly the
same, the difference is 1 hour. The debug this, there is a need to
understanding the source code /DateUtils @ javarosa / core / src / org /
javarosa / core / model / utils / DateUtils.java
Please note: 1 hour in decimal will be formatted as 2 hour with the source
code above.
Minute & Second disparity: would be about (+/-)1 minute inaccurate. I
haven't run detailed test for each calculation in source code, thus unable
to know for sure of the decimal value of this inaccuracy. But that would not
matter too much since if you are going to calculate time difference, you
should factor in such inaccuracy.

So what I did yo fixed this and get a reasonably accurate time difference
calculation.

Conditions: use 2 time inputs, 1 for user to input, other to record time the
input was made (ODK Collect auto record current time when this prompt is
activated, if you use function now() - it will record the time when this
form is opened. So not good with recording time to reschedule in the middle
of an interview).
Calculate the difference between these 2 values, then minus 1 hour
disparity.
Format this result to time (you choose what format you want - I prefer
'%H:%M' , minute will be rounded up/down to account for second difference.

!Note: you will have to convert time variable to decimal by using
decimal-date-time(${variable} (to include date) or decimal-time
(${variable}) to not include time. Else when you do calculation like time1 -
time2 , it will be = 0, and when you do format-date-time for that result, it
will produce "type mismatch" error.

--

@ Yaw:

I just read your reply while writing this. Thanks. I got it working now.
Probably I put down wrong syntax.


There is an attachment so you can see what I did to get the desired result.
Output of that file is displayed here: screen shoot 3

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I have attached the time difference sheet sheet, courtesy of Hung Pham.
I used and generated a data set.
However, it does not seem to be working. The time difference for the first
row should have been between 8-9 minutes. I don't see this anywhere.
After trying this for several days without fruition, I am hoping someone
can show me what the issue is.

Thanks in advance.

Louis...

test_calc_fuct_3_2015_10_06_04_22_24.xlsx (9.7 KB)

test_cal_fuct_assign_value (1).xls (28 KB)

··· On Sun, Oct 4, 2015 at 7:54 PM, Hung Pham wrote:

You ahould separate 2 times, there minus sign between 2 variables should
be well spaced. Try to put space for that minus.

H. Pham
+84 9175 410 38 <+84%209175%20410%2038>

On Sun, Oct 4, 2015 at 5:15 AM -0700, "Louis Omoya" louisomoya@gmail.com wrote:

ODK Validate Errors: org.javarosa.xform.parse.XFormParseException: Invalid

calculate for the bind attached to "${time_diff}" : Bad node:
org.javarosa.xpath.parser.ast.ASTNodeAbstractExpr@44a901f8 in expression
[decimal-time( ${time2} )-decimal-time( ${time1} )- ${hour_decimal} ] >>
XForm is invalid. See above for the errors. Result: Invalid

[decimal-time(${time2})-decimal-time(${time1})-${hour_decimal}]

I used the calculate line above. It generated the message in red above.

Was I on the right track?

Thanks in advance.

Louis...

On Sat, Oct 3, 2015 at 2:00 PM, Louis Omoya louisomoya@gmail.com wrote:

Thanks a lot.

On Sat, Oct 3, 2015 at 1:59 PM, Hung Pham Gmail hpham2709@gmail.com wrote:

Hi Louis,

You can do something like this:

[ decimal-time(${end}) - decimal-time(${start}) - ${hour_decimal} ]
this should give you a time difference in decimal. [format-date-time()]
this result to get it in the format you want. Refer to JavaROSA source I
posted, then scroll down to section where it defines format.

If you don't adjust 1 hour disparity, the formatted result will be 1
hour more than actual difference. I think there is some underlining issue
with how JavaROSA convert date-time type of data. But it still works
properly.

--

Hung M Pham
Market Researcher
On 03/10/15 10:08, Louis Omoya wrote:

Hi? I have been following your activities with ken interest. I am
looking for a way to calculate the difference between a start and end time.
I have seen the screen shots and excel file you attached. Does this
mean you have devised a way to calculate two time inputs?

Louis...

On Fri, Oct 2, 2015 at 3:50 PM, Hung Pham hpham2709@gmail.com wrote:

Dear all,

After extensive testing function calculate, I come to some conclusions
with a hope that if anyone who tries to calculate time difference in
XLSForm will be able to get a more satisfactory result.

  1. My earlier reported Validate error for decimal-date-time is
    false, please discard that issue, I rebuild the sheet, turn off
    auto_input to avoid auto_correcting function that turns lower case 1st
    letter to upper case, etc. in .xls file. It works now.
  2. Time functions work well, but There is a disparity of up to 1
    hour
    when try to calculate time difference. This means that if 2
    input times exactly the same, the difference is 1 hour. The
    debug this, there is a need to understanding the source code /DateUtils @
    javarosa / core / src / org / javarosa / core / model / utils /
    DateUtils.java
    https://bitbucket.org/m.sundt/javarosa/src/62409ae3b803/core/src/org/javarosa/core/model/utils/DateUtils.java?fileviewer=file-view-default#cl-247
  3. Please note: 1 hour in decimal will be formatted as 2 hour
    with the source code above
    .
  4. Minute & Second disparity: would be about (+/-)1 minute
    inaccurate
    . I haven't run detailed test for each calculation in
    source code, thus unable to know for sure of the decimal value of this
    inaccuracy. But that would not matter too much since if you are going to
    calculate time difference, you should factor in such inaccuracy.

So what I did yo fixed this and get a reasonably accurate time
difference calculation.

  • Conditions: use 2 time inputs, 1 for user to input, other to
    record time the input was made (ODK Collect auto record current time when
    this prompt is activated, if you use function now() - it will record the
    time when this form is opened. So not good with recording time to
    reschedule in the middle of an interview).
  • Calculate the difference between these 2 values, then minus 1
    hour disparity.
  • Format this result to time (you choose what format you want - I
    prefer '%H:%M' , minute will be rounded up/down to account for second
    difference.

!Note: you will have to convert time variable to decimal by using
decimal-date-time(${variable} (to include date) or decimal-time
(${variable}) to not include time. Else when you do calculation like *time1

  • time2* , it will be* = 0*, and when you do format-date-time for
    that result, it will produce "type mismatch" error.

--

@ Yaw:

I just read your reply while writing this. Thanks. I got it working
now. Probably I put down wrong syntax.


There is an attachment so you can see what I did to get the desired
result. Output of that file is displayed here: screen shoot 3
https://drive.google.com/file/d/0B78RrlVhNzEZVnRvdlBSNURUYTA/view?usp=sharing

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google
Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yes, there are known issues with time and date handling in the underlying
libraries.

It would be nice if someone would redo that whole area of the code. As you
have seen, many parts of it are broken.

··· On Tue, Oct 6, 2015 at 2:25 AM, Louis Omoya wrote:

I have attached the time difference sheet sheet, courtesy of Hung Pham.
I used and generated a data set.
However, it does not seem to be working. The time difference for the first
row should have been between 8-9 minutes. I don't see this anywhere.
After trying this for several days without fruition, I am hoping someone
can show me what the issue is.

Thanks in advance.

Louis...

On Sun, Oct 4, 2015 at 7:54 PM, Hung Pham hpham2709@gmail.com wrote:

You ahould separate 2 times, there minus sign between 2 variables should
be well spaced. Try to put space for that minus.

H. Pham
+84 9175 410 38 <+84%209175%20410%2038>

On Sun, Oct 4, 2015 at 5:15 AM -0700, "Louis Omoya" <louisomoya@gmail.com wrote:

ODK Validate Errors: org.javarosa.xform.parse.XFormParseException:

Invalid calculate for the bind attached to "${time_diff}" : Bad node:
org.javarosa.xpath.parser.ast.ASTNodeAbstractExpr@44a901f8 in
expression [decimal-time( ${time2} )-decimal-time( ${time1} )-
${hour_decimal} ] >> XForm is invalid. See above for the errors. Result:
Invalid

[decimal-time(${time2})-decimal-time(${time1})-${hour_decimal}]

I used the calculate line above. It generated the message in red above.

Was I on the right track?

Thanks in advance.

Louis...

On Sat, Oct 3, 2015 at 2:00 PM, Louis Omoya louisomoya@gmail.com wrote:

Thanks a lot.

On Sat, Oct 3, 2015 at 1:59 PM, Hung Pham Gmail hpham2709@gmail.com wrote:

Hi Louis,

You can do something like this:

[ decimal-time(${end}) - decimal-time(${start}) - ${hour_decimal} ]
this should give you a time difference in decimal. [format-date-time()]
this result to get it in the format you want. Refer to JavaROSA source I
posted, then scroll down to section where it defines format.

If you don't adjust 1 hour disparity, the formatted result will be 1
hour more than actual difference. I think there is some underlining issue
with how JavaROSA convert date-time type of data. But it still works
properly.

--

Hung M Pham
Market Researcher
On 03/10/15 10:08, Louis Omoya wrote:

Hi? I have been following your activities with ken interest. I am
looking for a way to calculate the difference between a start and end time.
I have seen the screen shots and excel file you attached. Does this
mean you have devised a way to calculate two time inputs?

Louis...

On Fri, Oct 2, 2015 at 3:50 PM, Hung Pham hpham2709@gmail.com wrote:

Dear all,

After extensive testing function calculate, I come to some
conclusions with a hope that if anyone who tries to calculate time
difference in XLSForm will be able to get a more satisfactory result.

  1. My earlier reported Validate error for decimal-date-time is
    false, please discard that issue, I rebuild the sheet, turn off
    auto_input to avoid auto_correcting function that turns lower case 1st
    letter to upper case, etc. in .xls file. It works now.
  2. Time functions work well, but There is a disparity of up to 1
    hour
    when try to calculate time difference. This means that if 2
    input times exactly the same, the difference is 1 hour. The
    debug this, there is a need to understanding the source code /DateUtils @
    javarosa / core / src / org / javarosa / core / model / utils /
    DateUtils.java
    https://bitbucket.org/m.sundt/javarosa/src/62409ae3b803/core/src/org/javarosa/core/model/utils/DateUtils.java?fileviewer=file-view-default#cl-247
  3. Please note: 1 hour in decimal will be formatted as 2 hour
    with the source code above
    .
  4. Minute & Second disparity: would be about (+/-)1 minute
    inaccurate
    . I haven't run detailed test for each calculation in
    source code, thus unable to know for sure of the decimal value of this
    inaccuracy. But that would not matter too much since if you are going to
    calculate time difference, you should factor in such inaccuracy.

So what I did yo fixed this and get a reasonably accurate time
difference calculation.

  • Conditions: use 2 time inputs, 1 for user to input, other to
    record time the input was made (ODK Collect auto record current time when
    this prompt is activated, if you use function now() - it will record the
    time when this form is opened. So not good with recording time to
    reschedule in the middle of an interview).
  • Calculate the difference between these 2 values, then minus 1
    hour disparity.
  • Format this result to time (you choose what format you want - I
    prefer '%H:%M' , minute will be rounded up/down to account for second
    difference.

!Note: you will have to convert time variable to decimal by using
decimal-date-time(${variable} (to include date) or decimal-time
(${variable}) to not include time. Else when you do calculation like *time1

  • time2* , it will be* = 0*, and when you do format-date-time for
    that result, it will produce "type mismatch" error.

--

@ Yaw:

I just read your reply while writing this. Thanks. I got it working
now. Probably I put down wrong syntax.


There is an attachment so you can see what I did to get the desired
result. Output of that file is displayed here: screen shoot 3
https://drive.google.com/file/d/0B78RrlVhNzEZVnRvdlBSNURUYTA/view?usp=sharing

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google
Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Dear all,

The results are bad. I don't know why yet.

But Mitch, can you point me to the underlying libraries involving these
please? I am still not yet fully able to transverse around JavaROSA folder
on Github with ease.

Thanks.

Hung

Hi Hung,

https://bitbucket.org/m.sundt/javarosa is the source. Start at
core/src/org/javarosa/core/model/data/DateTimeData and work from
there.

Yaw

··· -- Need ODK consultants? https://nafundi.com provides form design, server setup, in-field training, and software development for ODK.

On Wed, Oct 7, 2015 at 3:30 PM, Hung Pham hpham2709@gmail.com wrote:

Dear all,

The results are bad. I don't know why yet.

But Mitch, can you point me to the underlying libraries involving these
please? I am still not yet fully able to transverse around JavaROSA folder
on Github with ease.

Thanks.

Hung

Any update on duration calculation?

I have developed a very inelegant workaround in XLSForm that might suit most survey purposes. It only provides meaningful duration calculations for cases where the duration of interest is <24 hours and the start and end times are on the same date - however, I guess this is the vast majority of duration calculations most people doing surveys will need.

It basically uses the format-date-time function to clip out the hours and minutes as text strings, then converts to integers for the final duration calculations. I suppose you could put days into the calculation as well by the same method. Any times which have different dates are excluded (which is what we would do while monitoring data collection anyway - if the survey duration goes over two days this normally implies that the interviewer had to return to complete the interview or forgot to finalise the interview at the time of completion).

I've done some limited testing and it seems to work fine, without the occasional errors which I was getting using Hung's method - but I'm no coder so I'm sure someone can/will point out some flaw in this. I was hoping to avoid the decimal conversion which seemed to be producing odd results. I would really appreciate advice as to whether I'm way off track with this approach? Hung, did you manage to figure out an error-free way?

I'll update if I find issues with further testing.

I am using this for a basic 'speed check' to make sure that sections of the survey aren't completed under the minimum feasible time. I've attached the XLSForm syntax, complete with the duration in both text and integer (minutes) form, as well as the 'speed check' note. Like Hung, I've found the 'read only' timestamp to be the best way to get a time fix -with the added advantage that the interviewer is made aware at each section that their time is being monitored - so hopefully won't try to game the system :). A 'read-only' timestamp at the beginning/end of each survey section or group is what we are using to get section times.

Cheers,

Matt

duration check example.xls (23.5 KB)

Thanks

this really work for me

··· On Tuesday, 13 September 2016 20:43:54 UTC+3, matthe...@gmail.com wrote: > Any update on duration calculation? > > I have developed a very inelegant workaround in XLSForm that might suit most survey purposes. It only provides meaningful duration calculations for cases where the duration of interest is <24 hours and the start and end times are on the same date - however, I guess this is the vast majority of duration calculations most people doing surveys will need. > > It basically uses the format-date-time function to clip out the hours and minutes as text strings, then converts to integers for the final duration calculations. I suppose you could put days into the calculation as well by the same method. Any times which have different dates are excluded (which is what we would do while monitoring data collection anyway - if the survey duration goes over two days this normally implies that the interviewer had to return to complete the interview or forgot to finalise the interview at the time of completion). > > I've done some limited testing and it seems to work fine, without the occasional errors which I was getting using Hung's method - but I'm no coder so I'm sure someone can/will point out some flaw in this. I was hoping to avoid the decimal conversion which seemed to be producing odd results. I would really appreciate advice as to whether I'm way off track with this approach? Hung, did you manage to figure out an error-free way? > > I'll update if I find issues with further testing. > > I am using this for a basic 'speed check' to make sure that sections of the survey aren't completed under the minimum feasible time. I've attached the XLSForm syntax, complete with the duration in both text and integer (minutes) form, as well as the 'speed check' note. Like Hung, I've found the 'read only' timestamp to be the best way to get a time fix -with the added advantage that the interviewer is made aware at each section that their time is being monitored - so hopefully won't try to game the system :). A 'read-only' timestamp at the beginning/end of each survey section or group is what we are using to get section times. > > Cheers, > > Matt