Collect v1.4 Problem: now() not returning new date each instance

Hello,

I am attempting to capture a new timestamp for each question in my ODK
survey; I am doing this by having the program calculate "format-date-time(now(),
'%H:%M:%S')" before each question. Now, per rev 1033 for Collect (see https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes
for release notes), I expected the operator 'now()' to compute a new value
every time it is used, yet, when I have multiple timestamp-capture
attempts, the calculations are all returning the same value as the
pre-loaded "start" function. Thus, I have concluded that 'now()' is not
returning a new value each time.

Does anyone have any suggestions on how I can get a new timestamp each
time? I am fairly new to ODK, so I'd greatly appreciate any help.

Thanks!
Melanie

ODK Collect eagerly evaluates formulas. When the form is first opened, all
calculations which are determined to be relevant are executed and the
computed values are assigned -- hence why the now() all evaluates to the
same time.

After this, these values are only recomputed if a value that the formula is
dependent upon changes. If you are just using "now()" as the formula, they
will never be recomputed. When defining calculated expressions, it is
important to keep this in mind -- they are evaluated whenever something
they depend upon changes, not in the order in which they appear in your
form definition (e.g., XLS file).

You can still use them to record times at which answer values change.
However, they are not able to record the times at which a user transits
through a question without changing its value.

With that large caveat, to capture the time-of-change, you need a
calculation that depends upon the question. I.e., in XLSForm terms, this
works:

if( boolean-from-string(${question}), now(), now() )

This formula depends upon the preceding question (${question}) so it will
be evaluated whenever the answer to that question changes. The formula
evaluates now() regardless of what that question's value is.

Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation --
the placement of the calculated value within the survey dictates when it is
evaluated and assigned.

Mitch

··· On Thu, Dec 26, 2013 at 9:24 AM, Melanie W wrote:

Hello,

I am attempting to capture a new timestamp for each question in my ODK
survey; I am doing this by having the program calculate "format-date-time(now(),
'%H:%M:%S')" before each question. Now, per rev 1033 for Collect (see
https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for
release notes), I expected the operator 'now()' to compute a new value
every time it is used, yet, when I have multiple timestamp-capture
attempts, the calculations are all returning the same value as the
pre-loaded "start" function. Thus, I have concluded that 'now()' is not
returning a new value each time.

Does anyone have any suggestions on how I can get a new timestamp each
time? I am fairly new to ODK, so I'd greatly appreciate any help.

Thanks!
Melanie

--

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/groups/opt_out.

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

Great, thank you!

··· On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote: > > ODK Collect eagerly evaluates formulas. When the form is first opened, all > calculations which are determined to be relevant are executed and the > computed values are assigned -- hence why the now() all evaluates to the > same time. > > After this, these values are only recomputed if a value that the formula > is dependent upon changes. If you are just using "now()" as the formula, > they will never be recomputed. When defining calculated expressions, it is > important to keep this in mind -- they are evaluated whenever something > they depend upon changes, not in the order in which they appear in your > form definition (e.g., XLS file). > > You can still use them to record times at which answer values change. > However, they are not able to record the times at which a user transits > through a question without changing its value. > > With that large caveat, to capture the time-of-change, you need a > calculation that depends upon the question. I.e., in XLSForm terms, this > works: > > if( boolean-from-string(${question}), now(), now() ) > > This formula depends upon the preceding question (${question}) so it will > be evaluated whenever the answer to that question changes. The formula > evaluates now() regardless of what that question's value is. > > Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation -- > the placement of the calculated value within the survey dictates when it is > evaluated and assigned. > > Mitch > > > > On Thu, Dec 26, 2013 at 9:24 AM, Melanie W <surveyprog...@gmail.com wrote: > >> Hello, >> >> I am attempting to capture a new timestamp for each question in my ODK >> survey; I am doing this by having the program calculate "format-date-time(now(), >> '%H:%M:%S')" before each question. Now, per rev 1033 for Collect (see >> https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for >> release notes), I expected the operator 'now()' to compute a new value >> every time it is used, yet, when I have multiple timestamp-capture >> attempts, the calculations are all returning the same value as the >> pre-loaded "start" function. Thus, I have concluded that 'now()' is not >> returning a new value each time. >> >> Does anyone have any suggestions on how I can get a new timestamp each >> time? I am fairly new to ODK, so I'd greatly appreciate any help. >> >> Thanks! >> Melanie >> >> -- >> -- >> 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/groups/opt_out. >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >

A follow up:

Now that I've added the if() statements to the calculates (e.g. if(
boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'),
format-date-time(now(), '%H:%M:%S'))
), the now() operators are returning
the end times of the surveys. Does this mean that calculations, if they
depend upon questions, are held off until the end of the survey? I'd like
to have a timestamp at the exact (more-or-less) instant that each question
is answered... Is this possible, or should I be switching to ODK 2.0?

Thanks!
Melanie

··· On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote: > > Great, thank you! > > On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote: >> >> ODK Collect eagerly evaluates formulas. When the form is first opened, >> all calculations which are determined to be relevant are executed and the >> computed values are assigned -- hence why the now() all evaluates to the >> same time. >> >> After this, these values are only recomputed if a value that the formula >> is dependent upon changes. If you are just using "now()" as the formula, >> they will never be recomputed. When defining calculated expressions, it is >> important to keep this in mind -- they are evaluated whenever something >> they depend upon changes, not in the order in which they appear in your >> form definition (e.g., XLS file). >> >> You can still use them to record times at which answer values change. >> However, they are not able to record the times at which a user transits >> through a question without changing its value. >> >> With that large caveat, to capture the time-of-change, you need a >> calculation that depends upon the question. I.e., in XLSForm terms, this >> works: >> >> if( boolean-from-string(${question}), now(), now() ) >> >> This formula depends upon the preceding question (${question}) so it will >> be evaluated whenever the answer to that question changes. The formula >> evaluates now() regardless of what that question's value is. >> >> Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation -- >> the placement of the calculated value within the survey dictates when it is >> evaluated and assigned. >> >> Mitch >> >> >> >> On Thu, Dec 26, 2013 at 9:24 AM, Melanie W wrote: >> >>> Hello, >>> >>> I am attempting to capture a new timestamp for each question in my ODK >>> survey; I am doing this by having the program calculate "format-date-time(now(), >>> '%H:%M:%S')" before each question. Now, per rev 1033 for Collect (see >>> https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for >>> release notes), I expected the operator 'now()' to compute a new value >>> every time it is used, yet, when I have multiple timestamp-capture >>> attempts, the calculations are all returning the same value as the >>> pre-loaded "start" function. Thus, I have concluded that 'now()' is not >>> returning a new value each time. >>> >>> Does anyone have any suggestions on how I can get a new timestamp each >>> time? I am fairly new to ODK, so I'd greatly appreciate any help. >>> >>> Thanks! >>> Melanie >>> >>> -- >>> -- >>> 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/groups/opt_out. >>> >> >> >> >> -- >> Mitch Sundt >> Software Engineer >> University of Washington >> mitche...@gmail.com >> >

Hmm. That is not the behavior I expect; the formulas must be being
evaluated at the time they are marked as complete.

The short answer is that 2.0 will better meet your needs. However, it is
still in Beta, and should not be used for production surveys until it
becomes a Release Candidate (we are working as fast as we can to get it
there -- no ETA).

Mitch

··· On Sun, Dec 29, 2013 at 12:45 PM, Melanie W wrote:

A follow up:

Now that I've added the if() statements to the calculates (e.g. if(
boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'),
format-date-time(now(), '%H:%M:%S'))
), the now() operators are
returning the end times of the surveys. Does this mean that calculations,
if they depend upon questions, are held off until the end of the survey?
I'd like to have a timestamp at the exact (more-or-less) instant that each
question is answered... Is this possible, or should I be switching to ODK
2.0?

Thanks!
Melanie

On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote:

Great, thank you!

On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote:

ODK Collect eagerly evaluates formulas. When the form is first opened,
all calculations which are determined to be relevant are executed and the
computed values are assigned -- hence why the now() all evaluates to the
same time.

After this, these values are only recomputed if a value that the formula
is dependent upon changes. If you are just using "now()" as the formula,
they will never be recomputed. When defining calculated expressions, it is
important to keep this in mind -- they are evaluated whenever something
they depend upon changes, not in the order in which they appear in your
form definition (e.g., XLS file).

You can still use them to record times at which answer values change.
However, they are not able to record the times at which a user transits
through a question without changing its value.

With that large caveat, to capture the time-of-change, you need a
calculation that depends upon the question. I.e., in XLSForm terms, this
works:

if( boolean-from-string(${question}), now(), now() )

This formula depends upon the preceding question (${question}) so it
will be evaluated whenever the answer to that question changes. The formula
evaluates now() regardless of what that question's value is.

Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation --
the placement of the calculated value within the survey dictates when it is
evaluated and assigned.

Mitch

On Thu, Dec 26, 2013 at 9:24 AM, Melanie W surveyprog...@gmail.comwrote:

Hello,

I am attempting to capture a new timestamp for each question in my ODK
survey; I am doing this by having the program calculate "format-date-time(now(),
'%H:%M:%S')" before each question. Now, per rev 1033 for Collect (see
https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for
release notes), I expected the operator 'now()' to compute a new value
every time it is used, yet, when I have multiple timestamp-capture
attempts, the calculations are all returning the same value as the
pre-loaded "start" function. Thus, I have concluded that 'now()' is not
returning a new value each time.

Does anyone have any suggestions on how I can get a new timestamp each
time? I am fairly new to ODK, so I'd greatly appreciate any help.

Thanks!
Melanie

--

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/groups/opt_out.

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

--
--
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/groups/opt_out.

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

Of course, I understand. Thanks again!
Melanie

··· On Monday, December 30, 2013 6:45:03 PM UTC-5, Mitch Sundt wrote: > > Hmm. That is not the behavior I expect; the formulas must be being > evaluated at the time they are marked as complete. > > The short answer is that 2.0 will better meet your needs. However, it is > still in Beta, and should not be used for production surveys until it > becomes a Release Candidate (we are working as fast as we can to get it > there -- no ETA). > > Mitch > > > > On Sun, Dec 29, 2013 at 12:45 PM, Melanie W <surveyprog...@gmail.com wrote: > >> A follow up: >> >> Now that I've added the if() statements to the calculates (e.g. *if( >> boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'), >> format-date-time(now(), '%H:%M:%S'))* ), the now() operators are >> returning the end times of the surveys. Does this mean that calculations, >> if they depend upon questions, are held off until the end of the survey? >> I'd like to have a timestamp at the exact (more-or-less) instant that each >> question is answered... Is this possible, or should I be switching to ODK >> 2.0? >> >> Thanks! >> Melanie >> >> On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote: >>> >>> Great, thank you! >>> >>> On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote: >>>> >>>> ODK Collect eagerly evaluates formulas. When the form is first opened, >>>> all calculations which are determined to be relevant are executed and the >>>> computed values are assigned -- hence why the now() all evaluates to the >>>> same time. >>>> >>>> After this, these values are only recomputed if a value that the >>>> formula is dependent upon changes. If you are just using "now()" as the >>>> formula, they will never be recomputed. When defining calculated >>>> expressions, it is important to keep this in mind -- they are evaluated >>>> whenever something they depend upon changes, not in the order in which they >>>> appear in your form definition (e.g., XLS file). >>>> >>>> You can still use them to record times at which answer values change. >>>> However, they are not able to record the times at which a user transits >>>> through a question without changing its value. >>>> >>>> With that large caveat, to capture the time-of-change, you need a >>>> calculation that depends upon the question. I.e., in XLSForm terms, this >>>> works: >>>> >>>> if( boolean-from-string(${question}), now(), now() ) >>>> >>>> This formula depends upon the preceding question (${question}) so it >>>> will be evaluated whenever the answer to that question changes. The formula >>>> evaluates now() regardless of what that question's value is. >>>> >>>> Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation >>>> -- the placement of the calculated value within the survey dictates when it >>>> is evaluated and assigned. >>>> >>>> Mitch >>>> >>>> >>>> >>>> On Thu, Dec 26, 2013 at 9:24 AM, Melanie W wrote: >>>> >>>>> Hello, >>>>> >>>>> I am attempting to capture a new timestamp for each question in my ODK >>>>> survey; I am doing this by having the program calculate "format-date-time(now(), >>>>> '%H:%M:%S')" before each question. Now, per rev 1033 for Collect (see >>>>> https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for >>>>> release notes), I expected the operator 'now()' to compute a new value >>>>> every time it is used, yet, when I have multiple timestamp-capture >>>>> attempts, the calculations are all returning the same value as the >>>>> pre-loaded "start" function. Thus, I have concluded that 'now()' is not >>>>> returning a new value each time. >>>>> >>>>> Does anyone have any suggestions on how I can get a new timestamp each >>>>> time? I am fairly new to ODK, so I'd greatly appreciate any help. >>>>> >>>>> Thanks! >>>>> Melanie >>>>> >>>>> -- >>>>> -- >>>>> 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/groups/opt_out. >>>>> >>>> >>>> >>>> >>>> -- >>>> Mitch Sundt >>>> Software Engineer >>>> University of Washington >>>> mitche...@gmail.com >>>> >>> -- >> -- >> 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/groups/opt_out. >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >

I just want to add I've run into this problem, too.
I wanted to get timings for survey... For optimization/control reasons.

I'm eagerly looking for solution :slight_smile:

Zbig

PS. ODK is a marvelous project.

··· On Tuesday, December 31, 2013 12:45:03 AM UTC+1, Mitch Sundt wrote: > Hmm. That is not the behavior I expect; the formulas must be being evaluated at the time they are marked as complete. > > > The short answer is that 2.0 will better meet your needs. However, it is still in Beta, and should not be used for production surveys until it becomes a Release Candidate (we are working as fast as we can to get it there -- no ETA). > > > > Mitch > > > > > > On Sun, Dec 29, 2013 at 12:45 PM, Melanie W wrote: > > > A follow up: > > > Now that I've added the if() statements to the calculates (e.g. if( boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'), format-date-time(now(), '%H:%M:%S')) ), the now() operators are returning the end times of the surveys. Does this mean that calculations, if they depend upon questions, are held off until the end of the survey? I'd like to have a timestamp at the exact (more-or-less) instant that each question is answered... Is this possible, or should I be switching to ODK 2.0? > > > > Thanks! > Melanie > > > > On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote: > > Great, thank you! > > On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote: > > ODK Collect eagerly evaluates formulas. When the form is first opened, all calculations which are determined to be relevant are executed and the computed values are assigned -- hence why the now() all evaluates to the same time. > > > > > After this, these values are only recomputed if a value that the formula is dependent upon changes. If you are just using "now()" as the formula, they will never be recomputed. When defining calculated expressions, it is important to keep this in mind -- they are evaluated whenever something they depend upon changes, not in the order in which they appear in your form definition (e.g., XLS file). > > > > > > You can still use them to record times at which answer values change. However, they are not able to record the times at which a user transits through a question without changing its value. > > > > > With that large caveat, to capture the time-of-change, you need a calculation that depends upon the question. I.e., in XLSForm terms, this works: > > > if( boolean-from-string(${question}), now(), now() ) > > > > > This formula depends upon the preceding question (${question}) so it will be evaluated whenever the answer to that question changes. The formula evaluates now() regardless of what that question's value is. > > > > > Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation -- the placement of the calculated value within the survey dictates when it is evaluated and assigned. > > > Mitch > > > > > > > > On Thu, Dec 26, 2013 at 9:24 AM, Melanie W wrote: > > > Hello, > > > I am attempting to capture a new timestamp for each question in my ODK survey; I am doing this by having the program calculate "format-date-time(now(), '%H:%M:%S')" before each question. Now, per rev 1033 for Collect (see https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for release notes), I expected the operator 'now()' to compute a new value every time it is used, yet, when I have multiple timestamp-capture attempts, the calculations are all returning the same value as the pre-loaded "start" function. Thus, I have concluded that 'now()' is not returning a new value each time. > > > > > Does anyone have any suggestions on how I can get a new timestamp each time? I am fairly new to ODK, so I'd greatly appreciate any help. > > > Thanks! > Melanie > > > > > > > -- > > -- > > 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/groups/opt_out. > > > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com > > > > > > > > > -- > > -- > > 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/groups/opt_out. > > > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com

Have you upgraded to 1.4.3? Is it still a problem there?

If so, open an issue at http://code.google.com/p/opendatakit/issues/list

··· On Sun, Jun 22, 2014 at 5:14 AM, wrote:

I just want to add I've run into this problem, too.
I wanted to get timings for survey... For optimization/control reasons.

I'm eagerly looking for solution :slight_smile:

Zbig

PS. ODK is a marvelous project.

On Tuesday, December 31, 2013 12:45:03 AM UTC+1, Mitch Sundt wrote:

Hmm. That is not the behavior I expect; the formulas must be being
evaluated at the time they are marked as complete.

The short answer is that 2.0 will better meet your needs. However, it is
still in Beta, and should not be used for production surveys until it
becomes a Release Candidate (we are working as fast as we can to get it
there -- no ETA).

Mitch

On Sun, Dec 29, 2013 at 12:45 PM, Melanie W surveyprog...@gmail.com wrote:

A follow up:

Now that I've added the if() statements to the calculates (e.g. if(
boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'),
format-date-time(now(), '%H:%M:%S')) ), the now() operators are returning
the end times of the surveys. Does this mean that calculations, if they
depend upon questions, are held off until the end of the survey? I'd like
to have a timestamp at the exact (more-or-less) instant that each question
is answered... Is this possible, or should I be switching to ODK 2.0?

Thanks!
Melanie

On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote:

Great, thank you!

On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote:

ODK Collect eagerly evaluates formulas. When the form is first opened,
all calculations which are determined to be relevant are executed and the
computed values are assigned -- hence why the now() all evaluates to the
same time.

After this, these values are only recomputed if a value that the formula
is dependent upon changes. If you are just using "now()" as the formula,
they will never be recomputed. When defining calculated expressions, it is
important to keep this in mind -- they are evaluated whenever something
they depend upon changes, not in the order in which they appear in your
form definition (e.g., XLS file).

You can still use them to record times at which answer values change.
However, they are not able to record the times at which a user transits
through a question without changing its value.

With that large caveat, to capture the time-of-change, you need a
calculation that depends upon the question. I.e., in XLSForm terms, this
works:

if( boolean-from-string(${question}), now(), now() )

This formula depends upon the preceding question (${question}) so it
will be evaluated whenever the answer to that question changes. The formula
evaluates now() regardless of what that question's value is.

Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation --
the placement of the calculated value within the survey dictates when it is
evaluated and assigned.

Mitch

On Thu, Dec 26, 2013 at 9:24 AM, Melanie W surveyprog...@gmail.com wrote:

Hello,

I am attempting to capture a new timestamp for each question in my ODK
survey; I am doing this by having the program calculate
"format-date-time(now(), '%H:%M:%S')" before each question. Now, per rev
1033 for Collect (see
https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for
release notes), I expected the operator 'now()' to compute a new value
every time it is used, yet, when I have multiple timestamp-capture
attempts, the calculations are all returning the same value as the
pre-loaded "start" function. Thus, I have concluded that 'now()' is not
returning a new value each time.

Does anyone have any suggestions on how I can get a new timestamp each
time? I am fairly new to ODK, so I'd greatly appreciate any help.

Thanks!
Melanie

--

--

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/groups/opt_out.

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

--

--

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/groups/opt_out.

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

--

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

Zbig,

Starting with Collect 1.4.3, you can use the once() function to assure that
a calculation is only done once per survey, rather than repeatedly. So to
store the date as of the FIRST calculation:

once(now())

However, the first calculation will still likely be before you expect:
probably at the start of the form or whenever the enclosing repeat group is
initially created. Thus, it is not suitable for tracking the time at which
different points in your survey have been reached.

To solve this problem, we created a new "calculate_here" field type in
SurveyCTO that would calculate only when you swiped past a particular
location in the survey; in combination with the once() function, you can
reliably learn when the enumerator reached a particular point in a survey.
This particular modification was a somewhat-awkward "hack," because it very
much worked against the approach JavaRosa and Collect have generally taken
to calculated expressions. At SurveyCTO, we often develop these kinds of
"hacks" when they unlock sufficient value for our customers -- but it's a
bit difficult to contribute them back to the ODK core because of their
clash with the core design.

The need to capture survey timing comes up a lot. At SurveyCTO, we also
built a "text audit" field type to capture detail about the time spent on
every field. Mitch has also posted about a debug flag that, when present,
will allow Collect to dump details on survey timing to a log file -- but I
can't seem to find it just now. I believe that that debug mode may be your
best bet.

Best,

Chris

··· On Sun, Jun 22, 2014 at 8:14 AM, wrote:

I just want to add I've run into this problem, too.
I wanted to get timings for survey... For optimization/control reasons.

I'm eagerly looking for solution :slight_smile:

Zbig

PS. ODK is a marvelous project.

On Tuesday, December 31, 2013 12:45:03 AM UTC+1, Mitch Sundt wrote:

Hmm. That is not the behavior I expect; the formulas must be being
evaluated at the time they are marked as complete.

The short answer is that 2.0 will better meet your needs. However, it is
still in Beta, and should not be used for production surveys until it
becomes a Release Candidate (we are working as fast as we can to get it
there -- no ETA).

Mitch

On Sun, Dec 29, 2013 at 12:45 PM, Melanie W surveyprog...@gmail.com wrote:

A follow up:

Now that I've added the if() statements to the calculates (e.g. if(
boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'),
format-date-time(now(), '%H:%M:%S')) ), the now() operators are returning
the end times of the surveys. Does this mean that calculations, if they
depend upon questions, are held off until the end of the survey? I'd like
to have a timestamp at the exact (more-or-less) instant that each question
is answered... Is this possible, or should I be switching to ODK 2.0?

Thanks!
Melanie

On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote:

Great, thank you!

On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote:

ODK Collect eagerly evaluates formulas. When the form is first opened,
all calculations which are determined to be relevant are executed and the
computed values are assigned -- hence why the now() all evaluates to the
same time.

After this, these values are only recomputed if a value that the formula
is dependent upon changes. If you are just using "now()" as the formula,
they will never be recomputed. When defining calculated expressions, it is
important to keep this in mind -- they are evaluated whenever something
they depend upon changes, not in the order in which they appear in your
form definition (e.g., XLS file).

You can still use them to record times at which answer values change.
However, they are not able to record the times at which a user transits
through a question without changing its value.

With that large caveat, to capture the time-of-change, you need a
calculation that depends upon the question. I.e., in XLSForm terms, this
works:

if( boolean-from-string(${question}), now(), now() )

This formula depends upon the preceding question (${question}) so it
will be evaluated whenever the answer to that question changes. The formula
evaluates now() regardless of what that question's value is.

Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation --
the placement of the calculated value within the survey dictates when it is
evaluated and assigned.

Mitch

On Thu, Dec 26, 2013 at 9:24 AM, Melanie W surveyprog...@gmail.com wrote:

Hello,

I am attempting to capture a new timestamp for each question in my ODK
survey; I am doing this by having the program calculate
"format-date-time(now(), '%H:%M:%S')" before each question. Now, per rev
1033 for Collect (see
https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for
release notes), I expected the operator 'now()' to compute a new value
every time it is used, yet, when I have multiple timestamp-capture
attempts, the calculations are all returning the same value as the
pre-loaded "start" function. Thus, I have concluded that 'now()' is not
returning a new value each time.

Does anyone have any suggestions on how I can get a new timestamp each
time? I am fairly new to ODK, so I'd greatly appreciate any help.

Thanks!
Melanie

--

--

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/groups/opt_out.

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

--

--

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/groups/opt_out.

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

--

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.

Hi Mitch,
Yes, I'm using version 1.4.3
Data collection for 3 control points looks like below:

dtStart,"txText1","nTime1","txText2","nTime2","txText3","nTime3","dtEnd","nStart","nKoniec","meta:instanceID"
Fri
Jun 27 09:08:38 UTC 2014,"1","11:15:12","2","11:15:12","3","11:15:13","Fri
Jun 27 09:15:13 UTC 2014",,,"uuid:0ec96d32-4c37-4859-be32-9404cb098645"

Maybe I'm doing something wrong, but it doesn't work for me.

I'm using form as attached (xls and xmls versions).

Zbig

TestForm01-00-06.xls (23.5 KB)

TestForm01-00-06.xml (2.86 KB)

··· On Mon, Jun 23, 2014 at 6:57 PM, Mitch Sundt wrote:

Have you upgraded to 1.4.3? Is it still a problem there?

If so, open an issue at http://code.google.com/p/opendatakit/issues/list

On Sun, Jun 22, 2014 at 5:14 AM, zbigniew.piesniak@gmail.com wrote:

I just want to add I've run into this problem, too.
I wanted to get timings for survey... For optimization/control reasons.

I'm eagerly looking for solution :slight_smile:

Zbig

PS. ODK is a marvelous project.

On Tuesday, December 31, 2013 12:45:03 AM UTC+1, Mitch Sundt wrote:

Hmm. That is not the behavior I expect; the formulas must be being
evaluated at the time they are marked as complete.

The short answer is that 2.0 will better meet your needs. However, it
is still in Beta, and should not be used for production surveys until it
becomes a Release Candidate (we are working as fast as we can to get it
there -- no ETA).

Mitch

On Sun, Dec 29, 2013 at 12:45 PM, Melanie W surveyprog...@gmail.com wrote:

A follow up:

Now that I've added the if() statements to the calculates (e.g. if(
boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'),
format-date-time(now(), '%H:%M:%S')) ), the now() operators are returning
the end times of the surveys. Does this mean that calculations, if they
depend upon questions, are held off until the end of the survey? I'd like
to have a timestamp at the exact (more-or-less) instant that each question
is answered... Is this possible, or should I be switching to ODK 2.0?

Thanks!
Melanie

On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote:

Great, thank you!

On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote:

ODK Collect eagerly evaluates formulas. When the form is first opened,
all calculations which are determined to be relevant are executed and the
computed values are assigned -- hence why the now() all evaluates to the
same time.

After this, these values are only recomputed if a value that the
formula is dependent upon changes. If you are just using "now()" as the
formula, they will never be recomputed. When defining calculated
expressions, it is important to keep this in mind -- they are evaluated
whenever something they depend upon changes, not in the order in which they
appear in your form definition (e.g., XLS file).

You can still use them to record times at which answer values change.
However, they are not able to record the times at which a user transits
through a question without changing its value.

With that large caveat, to capture the time-of-change, you need a
calculation that depends upon the question. I.e., in XLSForm terms, this
works:

if( boolean-from-string(${question}), now(), now() )

This formula depends upon the preceding question (${question}) so it
will be evaluated whenever the answer to that question changes. The formula
evaluates now() regardless of what that question's value is.

Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation
-- the placement of the calculated value within the survey dictates when it
is evaluated and assigned.

Mitch

On Thu, Dec 26, 2013 at 9:24 AM, Melanie W surveyprog...@gmail.com wrote:

Hello,

I am attempting to capture a new timestamp for each question in my ODK
survey; I am doing this by having the program calculate
"format-date-time(now(), '%H:%M:%S')" before each question. Now, per rev
1033 for Collect (see
https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for
release notes), I expected the operator 'now()' to compute a new value
every time it is used, yet, when I have multiple timestamp-capture
attempts, the calculations are all returning the same value as the
pre-loaded "start" function. Thus, I have concluded that 'now()' is not
returning a new value each time.

Does anyone have any suggestions on how I can get a new timestamp each
time? I am fairly new to ODK, so I'd greatly appreciate any help.

Thanks!
Melanie

--

--

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/groups/opt_out.

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

--

--

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/groups/opt_out.

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

--

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

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/o4VroEqiZ2Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris,
thank you for info about the once() function. As you said - it seems to be
evaluated only once. In case once(now()) is used few times during the
survey - they all end up with the same value no matter when they were
supposed to be called.

With regards to the debugging - it's helpful, but not exactly what I was
looking for...
I wanted to provide the end - aggregator - with information already in the
collected data. Data from logs would have to be additionaly combined with
surveys...

I think I will file issue/enhancement request to ODK Collect :slight_smile:

Zbig

··· On Fri, Jun 27, 2014 at 12:28 PM, Christopher Robert wrote:

Zbig,

Starting with Collect 1.4.3, you can use the once() function to assure
that a calculation is only done once per survey, rather than repeatedly. So
to store the date as of the FIRST calculation:

once(now())

However, the first calculation will still likely be before you expect:
probably at the start of the form or whenever the enclosing repeat group is
initially created. Thus, it is not suitable for tracking the time at which
different points in your survey have been reached.

To solve this problem, we created a new "calculate_here" field type in
SurveyCTO that would calculate only when you swiped past a particular
location in the survey; in combination with the once() function, you can
reliably learn when the enumerator reached a particular point in a survey.
This particular modification was a somewhat-awkward "hack," because it very
much worked against the approach JavaRosa and Collect have generally taken
to calculated expressions. At SurveyCTO, we often develop these kinds of
"hacks" when they unlock sufficient value for our customers -- but it's a
bit difficult to contribute them back to the ODK core because of their
clash with the core design.

The need to capture survey timing comes up a lot. At SurveyCTO, we also
built a "text audit" field type to capture detail about the time spent on
every field. Mitch has also posted about a debug flag that, when present,
will allow Collect to dump details on survey timing to a log file -- but I
can't seem to find it just now. I believe that that debug mode may be your
best bet.

Best,

Chris

On Sun, Jun 22, 2014 at 8:14 AM, zbigniew.piesniak@gmail.com wrote:

I just want to add I've run into this problem, too.
I wanted to get timings for survey... For optimization/control reasons.

I'm eagerly looking for solution :slight_smile:

Zbig

PS. ODK is a marvelous project.

On Tuesday, December 31, 2013 12:45:03 AM UTC+1, Mitch Sundt wrote:

Hmm. That is not the behavior I expect; the formulas must be being
evaluated at the time they are marked as complete.

The short answer is that 2.0 will better meet your needs. However, it
is still in Beta, and should not be used for production surveys until it
becomes a Release Candidate (we are working as fast as we can to get it
there -- no ETA).

Mitch

On Sun, Dec 29, 2013 at 12:45 PM, Melanie W surveyprog...@gmail.com wrote:

A follow up:

Now that I've added the if() statements to the calculates (e.g. if(
boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'),
format-date-time(now(), '%H:%M:%S')) ), the now() operators are returning
the end times of the surveys. Does this mean that calculations, if they
depend upon questions, are held off until the end of the survey? I'd like
to have a timestamp at the exact (more-or-less) instant that each question
is answered... Is this possible, or should I be switching to ODK 2.0?

Thanks!
Melanie

On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote:

Great, thank you!

On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote:

ODK Collect eagerly evaluates formulas. When the form is first opened,
all calculations which are determined to be relevant are executed and the
computed values are assigned -- hence why the now() all evaluates to the
same time.

After this, these values are only recomputed if a value that the
formula is dependent upon changes. If you are just using "now()" as the
formula, they will never be recomputed. When defining calculated
expressions, it is important to keep this in mind -- they are evaluated
whenever something they depend upon changes, not in the order in which they
appear in your form definition (e.g., XLS file).

You can still use them to record times at which answer values change.
However, they are not able to record the times at which a user transits
through a question without changing its value.

With that large caveat, to capture the time-of-change, you need a
calculation that depends upon the question. I.e., in XLSForm terms, this
works:

if( boolean-from-string(${question}), now(), now() )

This formula depends upon the preceding question (${question}) so it
will be evaluated whenever the answer to that question changes. The formula
evaluates now() regardless of what that question's value is.

Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation
-- the placement of the calculated value within the survey dictates when it
is evaluated and assigned.

Mitch

On Thu, Dec 26, 2013 at 9:24 AM, Melanie W surveyprog...@gmail.com wrote:

Hello,

I am attempting to capture a new timestamp for each question in my ODK
survey; I am doing this by having the program calculate
"format-date-time(now(), '%H:%M:%S')" before each question. Now, per rev
1033 for Collect (see
https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for
release notes), I expected the operator 'now()' to compute a new value
every time it is used, yet, when I have multiple timestamp-capture
attempts, the calculations are all returning the same value as the
pre-loaded "start" function. Thus, I have concluded that 'now()' is not
returning a new value each time.

Does anyone have any suggestions on how I can get a new timestamp each
time? I am fairly new to ODK, so I'd greatly appreciate any help.

Thanks!
Melanie

--

--

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/groups/opt_out.

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

--

--

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/groups/opt_out.

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

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/o4VroEqiZ2Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

FYI
I opened an issue #1028.

Thnx,
Zbig

··· On Sat, Jun 28, 2014 at 12:20 PM, Zbigniew Pieśniak < zbigniew.piesniak@gmail.com> wrote:

Chris,
thank you for info about the once() function. As you said - it seems to be
evaluated only once. In case once(now()) is used few times during the
survey - they all end up with the same value no matter when they were
supposed to be called.

With regards to the debugging - it's helpful, but not exactly what I was
looking for...
I wanted to provide the end - aggregator - with information already in the
collected data. Data from logs would have to be additionaly combined with
surveys...

I think I will file issue/enhancement request to ODK Collect :slight_smile:

Zbig

On Fri, Jun 27, 2014 at 12:28 PM, Christopher Robert < crobert@surveycto.com> wrote:

Zbig,

Starting with Collect 1.4.3, you can use the once() function to assure
that a calculation is only done once per survey, rather than repeatedly. So
to store the date as of the FIRST calculation:

once(now())

However, the first calculation will still likely be before you expect:
probably at the start of the form or whenever the enclosing repeat group is
initially created. Thus, it is not suitable for tracking the time at which
different points in your survey have been reached.

To solve this problem, we created a new "calculate_here" field type in
SurveyCTO that would calculate only when you swiped past a particular
location in the survey; in combination with the once() function, you can
reliably learn when the enumerator reached a particular point in a survey.
This particular modification was a somewhat-awkward "hack," because it very
much worked against the approach JavaRosa and Collect have generally taken
to calculated expressions. At SurveyCTO, we often develop these kinds of
"hacks" when they unlock sufficient value for our customers -- but it's a
bit difficult to contribute them back to the ODK core because of their
clash with the core design.

The need to capture survey timing comes up a lot. At SurveyCTO, we also
built a "text audit" field type to capture detail about the time spent on
every field. Mitch has also posted about a debug flag that, when present,
will allow Collect to dump details on survey timing to a log file -- but I
can't seem to find it just now. I believe that that debug mode may be your
best bet.

Best,

Chris

On Sun, Jun 22, 2014 at 8:14 AM, zbigniew.piesniak@gmail.com wrote:

I just want to add I've run into this problem, too.
I wanted to get timings for survey... For optimization/control reasons.

I'm eagerly looking for solution :slight_smile:

Zbig

PS. ODK is a marvelous project.

On Tuesday, December 31, 2013 12:45:03 AM UTC+1, Mitch Sundt wrote:

Hmm. That is not the behavior I expect; the formulas must be being
evaluated at the time they are marked as complete.

The short answer is that 2.0 will better meet your needs. However, it
is still in Beta, and should not be used for production surveys until it
becomes a Release Candidate (we are working as fast as we can to get it
there -- no ETA).

Mitch

On Sun, Dec 29, 2013 at 12:45 PM, Melanie W surveyprog...@gmail.com wrote:

A follow up:

Now that I've added the if() statements to the calculates (e.g. if(
boolean-from-string(${sport}), format-date-time(now(), '%H:%M:%S'),
format-date-time(now(), '%H:%M:%S')) ), the now() operators are returning
the end times of the surveys. Does this mean that calculations, if they
depend upon questions, are held off until the end of the survey? I'd like
to have a timestamp at the exact (more-or-less) instant that each question
is answered... Is this possible, or should I be switching to ODK 2.0?

Thanks!
Melanie

On Sunday, December 29, 2013 11:43:48 AM UTC-5, Melanie W wrote:

Great, thank you!

On Thursday, December 26, 2013 3:05:29 PM UTC-5, Mitch Sundt wrote:

ODK Collect eagerly evaluates formulas. When the form is first opened,
all calculations which are determined to be relevant are executed and the
computed values are assigned -- hence why the now() all evaluates to the
same time.

After this, these values are only recomputed if a value that the
formula is dependent upon changes. If you are just using "now()" as the
formula, they will never be recomputed. When defining calculated
expressions, it is important to keep this in mind -- they are evaluated
whenever something they depend upon changes, not in the order in which they
appear in your form definition (e.g., XLS file).

You can still use them to record times at which answer values change.
However, they are not able to record the times at which a user transits
through a question without changing its value.

With that large caveat, to capture the time-of-change, you need a
calculation that depends upon the question. I.e., in XLSForm terms, this
works:

if( boolean-from-string(${question}), now(), now() )

This formula depends upon the preceding question (${question}) so it
will be evaluated whenever the answer to that question changes. The formula
evaluates now() regardless of what that question's value is.

Note also that ODK 2.0 (ODK Survey) does not do this eager evaluation
-- the placement of the calculated value within the survey dictates when it
is evaluated and assigned.

Mitch

On Thu, Dec 26, 2013 at 9:24 AM, Melanie W surveyprog...@gmail.com wrote:

Hello,

I am attempting to capture a new timestamp for each question in my ODK
survey; I am doing this by having the program calculate
"format-date-time(now(), '%H:%M:%S')" before each question. Now, per rev
1033 for Collect (see
https://code.google.com/p/opendatakit/wiki/CollectReleaseNotes for
release notes), I expected the operator 'now()' to compute a new value
every time it is used, yet, when I have multiple timestamp-capture
attempts, the calculations are all returning the same value as the
pre-loaded "start" function. Thus, I have concluded that 'now()' is not
returning a new value each time.

Does anyone have any suggestions on how I can get a new timestamp each
time? I am fairly new to ODK, so I'd greatly appreciate any help.

Thanks!
Melanie

--

--

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/groups/opt_out.

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

--

--

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/groups/opt_out.

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

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/o4VroEqiZ2Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.