I just want to add I've run into this problem, too.
I wanted to get timings for survey... For optimization/control reasons.
PS. ODK is a marvelous project.
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