Calculate and pulldata

I wrote a form with Koboform and Notepad++. the form preloads lots of data
using calculate="pulldata(..)", but i have a question... If I calculate or
preload some data to a text field (or whatever field), can the value be
changeable? I mean, if a text field, date field, select1 field has a
pre-calculated value, can i change it? will the answer not be changed to
the calculated value when i save it?

Hans,

I believe that only SurveyCTO has the capability to dynamically calculate
default values for visible fields (with, e.g., pulldata()). In other ODK
systems, calculations can only happen for "calculate" fields. (This is an
area where we chose to go "off spec" to deliver functionality we thought
useful for our users.)

Sorry,

Chris

··· On Tue, Nov 18, 2014 at 7:59 AM, Hans Rojas wrote:

I wrote a form with Koboform and Notepad++. the form preloads lots of data
using calculate="pulldata(..)", but i have a question... If I calculate or
preload some data to a text field (or whatever field), can the value be
changeable? I mean, if a text field, date field, select1 field has a
pre-calculated value, can i change it? will the answer not be changed to
the calculated value when i save it?

--

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.

Well, maybe I need to rephrase my question, bc i have a bigger problem, and
now i did some tests on the form.

I wrote the form. I preload the data from a CSV to some text fields, and
Collect shows them fine. when i change those preloaded values, it looks
like the form accepted them; you can see the new values on the question
viewer, answer viewer, or whatever it is named. BUT, when i save the form,
or if i complete the form, the new values get changed to the preloaded (or
calculated) values. I mean, the device does the calculations when it is
saving the form data... but i need the calculations only before i answer
the question. How can i change this behavior?

Im using ODK Collect 1.4.4

··· El martes, 18 de noviembre de 2014 09:59:50 UTC-3, Hans Rojas escribió: > > I wrote a form with Koboform and Notepad++. the form preloads lots of data > using calculate="pulldata(..)", but i have a question... If I calculate or > preload some data to a text field (or whatever field), can the value be > changeable? I mean, if a text field, date field, select1 field has a > pre-calculated value, can i change it? will the answer not be changed to > the calculated value when i save it? > > >

In SurveyCTO, our solution is to keep re-calculating automatically until
the field appears for the user
-- and from that point on we leave it to
the user and do not calculate it again.

Damn, i need that

··· El martes, 18 de noviembre de 2014 09:59:50 UTC-3, Hans Rojas escribió: > > I wrote a form with Koboform and Notepad++. the form preloads lots of data > using calculate="pulldata(..)", but i have a question... If I calculate or > preload some data to a text field (or whatever field), can the value be > changeable? I mean, if a text field, date field, select1 field has a > pre-calculated value, can i change it? will the answer not be changed to > the calculated value when i save it? > > >

Hans,

I can only repeat my original answer: I believe that the functionality that
you seek is only in SurveyCTO's version of Collect. That's because, as
you're seeing, most ODK systems (using JavaRosa) re-calculate calculations
at various points, including on save. You might try using the once()
function around your pulldata() call and MAYBE that will work -- but that
will likely fail in other cases you care about. See, it's not trivial to
have it calculate only when you want and not when you don't want. If you're
using pulldata() and using some ID that's entered by the user, for example,
then you can't just calculate it as soon as the form loads and then never
again. No: you need to wait until you have everything you need to calculate
it, then calculate it, then never again.

In SurveyCTO, our solution is to keep re-calculating automatically until
the field appears for the user
-- and from that point on we leave it to
the user and do not calculate it again. I'm sorry, but I don't believe that
this is in Kobo or ODK.

Best,

Chris

··· On Tue, Nov 18, 2014 at 2:06 PM, Hans Rojas wrote:

Well, maybe I need to rephrase my question, bc i have a bigger problem,
and now i did some tests on the form.

I wrote the form. I preload the data from a CSV to some text fields, and
Collect shows them fine. when i change those preloaded values, it looks
like the form accepted them; you can see the new values on the question
viewer, answer viewer, or whatever it is named. BUT, when i save the form,
or if i complete the form, the new values get changed to the preloaded (or
calculated) values. I mean, the device does the calculations when it is
saving the form data... but i need the calculations only before i answer
the question. How can i change this behavior?

Im using ODK Collect 1.4.4

El martes, 18 de noviembre de 2014 09:59:50 UTC-3, Hans Rojas escribió:

I wrote a form with Koboform and Notepad++. the form preloads lots of
data using calculate="pulldata(..)", but i have a question... If I
calculate or preload some data to a text field (or whatever field), can the
value be changeable? I mean, if a text field, date field, select1 field has
a pre-calculated value, can i change it? will the answer not be changed to
the calculated value when i save it?

--
--
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 Hans,

We'd be happy to have you use SurveyCTO -- but we do fund ourselves with
subscription fees. (Sorry! Everybody's got to eat somehow.) Here's a list
of what our subscription fees have funded so far:

We'll also try to get better about sharing more with the core ODK community
-- particularly as our expanding user base makes us less tight with time
and money.

Best,

Chris

··· On Tue, Nov 18, 2014 at 2:27 PM, Hans Rojas wrote:

In SurveyCTO, our solution is to keep re-calculating automatically until
the field appears for the user
-- and from that point on we leave it to
the user and do not calculate it again.

Damn, i need that

El martes, 18 de noviembre de 2014 09:59:50 UTC-3, Hans Rojas escribió:

I wrote a form with Koboform and Notepad++. the form preloads lots of
data using calculate="pulldata(..)", but i have a question... If I
calculate or preload some data to a text field (or whatever field), can the
value be changeable? I mean, if a text field, date field, select1 field has
a pre-calculated value, can i change it? will the answer not be changed to
the calculated value when i save it?

--
--
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 agree with Chris. This is not how ODK Collect was designed to work. And
once() may or may not get you 90% of the way to what you want.

If you want to present default values to a user and allow them to edit
them, the standard mechanism is to write wrapper tools that will construct
a pre-populated instance file with these defaults and register that
instance with ODK Collect. You can then launch ODK Collect to open and edit
/ update that particular instance file.

ODK Collect replaces paper-based forms:

You give it a blank form, and it can make copies of that blank form and
help you fill in the copy and save it.

It DOES NOT include a mail-merge feature that can take a blank form, merge
it with existing data values, emit a form with pre-filled fields, and then
open that and allow you to edit it. Those are the "wrapper tools" I talk
about above.

This functionality assumes you are sending data back down to the phone to
enable you to produce these pre-filled fields. That functionality is not
available in the 1.x tools, but is at the core of the 2.0 tool suite. The
1.x tools fill in blank forms, and submit them to a central aggregator;
they didn't do follow-up surveys.

··· On Tue, Nov 18, 2014 at 11:12 AM, Christopher Robert wrote:

Hans,

I can only repeat my original answer: I believe that the functionality
that you seek is only in SurveyCTO's version of Collect. That's because, as
you're seeing, most ODK systems (using JavaRosa) re-calculate calculations
at various points, including on save. You might try using the once()
function around your pulldata() call and MAYBE that will work -- but that
will likely fail in other cases you care about. See, it's not trivial to
have it calculate only when you want and not when you don't want. If you're
using pulldata() and using some ID that's entered by the user, for example,
then you can't just calculate it as soon as the form loads and then never
again. No: you need to wait until you have everything you need to calculate
it, then calculate it, then never again.

In SurveyCTO, our solution is to keep re-calculating automatically until
the field appears for the user
-- and from that point on we leave it to
the user and do not calculate it again. I'm sorry, but I don't believe that
this is in Kobo or ODK.

Best,

Chris

On Tue, Nov 18, 2014 at 2:06 PM, Hans Rojas arkangelx@gmail.com wrote:

Well, maybe I need to rephrase my question, bc i have a bigger problem,
and now i did some tests on the form.

I wrote the form. I preload the data from a CSV to some text fields, and
Collect shows them fine. when i change those preloaded values, it looks
like the form accepted them; you can see the new values on the question
viewer, answer viewer, or whatever it is named. BUT, when i save the form,
or if i complete the form, the new values get changed to the preloaded (or
calculated) values. I mean, the device does the calculations when it is
saving the form data... but i need the calculations only before i answer
the question. How can i change this behavior?

Im using ODK Collect 1.4.4

El martes, 18 de noviembre de 2014 09:59:50 UTC-3, Hans Rojas escribió:

I wrote a form with Koboform and Notepad++. the form preloads lots of
data using calculate="pulldata(..)", but i have a question... If I
calculate or preload some data to a text field (or whatever field), can the
value be changeable? I mean, if a text field, date field, select1 field has
a pre-calculated value, can i change it? will the answer not be changed to
the calculated value when i save it?

--
--
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