Default Value based on Calculation Field

Hi ,

is it possible to a Integer Field set as default value a previous
calculated field

type name label
default

calculate selectedtypea TypeA integer typeb CatB
int($(selectedtypea))

if i use an integer as a default value works fine, but when i use a
previous calculated field then pass the conversion to XLSForm but nothing
displays in Collect...

Thanks
Panos

1 Like

Panos,

This is a capability we recently added to SurveyCTO, but it's not yet in
the ODK core. Sorry. (We agree that it's very useful functionality. ODK 2.0
may allow it, as the core team seems to have greatly expanded functionality
in the new architecture.)

Best,

Chris

··· On Jul 3, 2014 8:31 AM, "Panos Papadatos" wrote:

Hi ,

is it possible to a Integer Field set as default value a previous
calculated field

type name label
default

calculate selectedtypea TypeA integer typeb CatB
int($(selectedtypea))

if i use an integer as a default value works fine, but when i use a
previous calculated field then pass the conversion to XLSForm but nothing
displays in Collect...

Thanks
Panos

--

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.

ODK 2.0 has assignment statements, so you can do computations and assign
them to variables (either stored as an instance field or in a transient
session variable). Defaults, however, are restricted to simple constant
values.

··· On Thu, Jul 3, 2014 at 5:35 AM, Christopher Robert wrote:

Panos,

This is a capability we recently added to SurveyCTO, but it's not yet in
the ODK core. Sorry. (We agree that it's very useful functionality. ODK 2.0
may allow it, as the core team seems to have greatly expanded functionality
in the new architecture.)

Best,

Chris
On Jul 3, 2014 8:31 AM, "Panos Papadatos" ppapadatosgr@gmail.com wrote:

Hi ,

is it possible to a Integer Field set as default value a previous
calculated field

type name label
default

calculate selectedtypea TypeA integer typeb CatB
int($(selectedtypea))

if i use an integer as a default value works fine, but when i use a
previous calculated field then pass the conversion to XLSForm but nothing
displays in Collect...

Thanks
Panos

--

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

1 Like

I don't think it's a very good idea to make defaults anything other than a
simple constant value. Chris, does this work in SurveyCTO when the question
and calculation dependencies are in the same field-list?

It would be better to support adding a calculation on a (read-only)
question (which may be supported already). Though the user won't be able to
change it in that case.

··· On Thursday, July 3, 2014 10:16:17 AM UTC-6, Mitch Sundt wrote: > > ODK 2.0 has assignment statements, so you can do computations and assign > them to variables (either stored as an instance field or in a transient > session variable). Defaults, however, are restricted to simple constant > values. > > > > On Thu, Jul 3, 2014 at 5:35 AM, Christopher Robert <cro...@surveycto.com > wrote: > >> Panos, >> >> This is a capability we recently added to SurveyCTO, but it's not yet in >> the ODK core. Sorry. (We agree that it's very useful functionality. ODK 2.0 >> may allow it, as the core team seems to have greatly expanded functionality >> in the new architecture.) >> >> Best, >> >> Chris >> On Jul 3, 2014 8:31 AM, "Panos Papadatos" <ppapad...@gmail.com > wrote: >> >>> Hi , >>> >>> is it possible to a Integer Field set as default value a previous >>> calculated field >>> >>> >>> >>> type name label >>> default >>> >>> calculate selectedtypea TypeA integer typeb CatB >>> int($(selectedtypea)) >>> >>> >>> if i use an integer as a default value works fine, but when i use a >>> previous calculated field then pass the conversion to XLSForm but nothing >>> displays in Collect... >>> >>> Thanks >>> Panos >>> >>> >>> >>> >>> >>> >>> -- >>> -- >>> 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: 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. >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >

Good idea or not, we opened it up so that you can put a calculation in for
nearly any kind of field. It allows for dynamic defaults, which have some
wonderfully useful applications. Of course, it's not without limitations,
and fields on the same screen are a problem -- but we don't like the
perfect to be the enemy of the good, and we didn't want to punish the
swipe-forward-to-each-question people because others wouldn't benefit.

Best,

Chris

··· On Jul 3, 2014 12:43 PM, "Martijn van de Rijdt" wrote:

I don't think it's a very good idea to make defaults anything other than a
simple constant value. Chris, does this work in SurveyCTO when the question
and calculation dependencies are in the same field-list?

It would be better to support adding a calculation on a (read-only)
question (which may be supported already). Though the user won't be able to
change it in that case.

On Thursday, July 3, 2014 10:16:17 AM UTC-6, Mitch Sundt wrote:

ODK 2.0 has assignment statements, so you can do computations and assign
them to variables (either stored as an instance field or in a transient
session variable). Defaults, however, are restricted to simple constant
values.

On Thu, Jul 3, 2014 at 5:35 AM, Christopher Robert cro...@surveycto.com wrote:

Panos,

This is a capability we recently added to SurveyCTO, but it's not yet in
the ODK core. Sorry. (We agree that it's very useful functionality. ODK 2.0
may allow it, as the core team seems to have greatly expanded functionality
in the new architecture.)

Best,

Chris
On Jul 3, 2014 8:31 AM, "Panos Papadatos" ppapad...@gmail.com wrote:

Hi ,

is it possible to a Integer Field set as default value a previous
calculated field

type name label
default

calculate selectedtypea TypeA integer typeb CatB
int($(selectedtypea))

if i use an integer as a default value works fine, but when i use a
previous calculated field then pass the conversion to XLSForm but nothing
displays in Collect...

Thanks
Panos

--

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

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

So in conclusion, there is no such functionality in odk 1.4.

I believe that is a very useful capability in cases that you don't want
from users repeating same values.

In my case i have to suggest a value to the user but he has to change that
value only if it is different from the suggested...
In previous steps i made the calculation.

That is the problem..

Right now he has to enter all the values once again... Even they are
unchanged...

Panos
Στις 3 Ιουλ 2014 8:25 μ.μ., ο χρήστης "Christopher Robert" <
crobert@surveycto.com> έγραψε:

··· > Good idea or not, we opened it up so that you can put a calculation in for > nearly any kind of field. It allows for dynamic defaults, which have some > wonderfully useful applications. Of course, it's not without limitations, > and fields on the same screen are a problem -- but we don't like the > perfect to be the enemy of the good, and we didn't want to punish the > swipe-forward-to-each-question people because others wouldn't benefit. > > Best, > > Chris > On Jul 3, 2014 12:43 PM, "Martijn van de Rijdt" wrote: > >> I don't think it's a very good idea to make defaults anything other than >> a simple constant value. Chris, does this work in SurveyCTO when the >> question and calculation dependencies are in the same field-list? >> >> It would be better to support adding a calculation on a (read-only) >> question (which may be supported already). Though the user won't be able to >> change it in that case. >> >> On Thursday, July 3, 2014 10:16:17 AM UTC-6, Mitch Sundt wrote: >>> >>> ODK 2.0 has assignment statements, so you can do computations and assign >>> them to variables (either stored as an instance field or in a transient >>> session variable). Defaults, however, are restricted to simple constant >>> values. >>> >>> >>> >>> On Thu, Jul 3, 2014 at 5:35 AM, Christopher Robert >> >>>> Panos, >>>> >>>> This is a capability we recently added to SurveyCTO, but it's not yet >>>> in the ODK core. Sorry. (We agree that it's very useful functionality. ODK >>>> 2.0 may allow it, as the core team seems to have greatly expanded >>>> functionality in the new architecture.) >>>> >>>> Best, >>>> >>>> Chris >>>> On Jul 3, 2014 8:31 AM, "Panos Papadatos" wrote: >>>> >>>>> Hi , >>>>> >>>>> is it possible to a Integer Field set as default value a previous >>>>> calculated field >>>>> >>>>> >>>>> >>>>> type name label >>>>> default >>>>> >>>>> calculate selectedtypea TypeA integer typeb CatB >>>>> int($(selectedtypea)) >>>>> >>>>> >>>>> if i use an integer as a default value works fine, but when i use a >>>>> previous calculated field then pass the conversion to XLSForm but nothing >>>>> displays in Collect... >>>>> >>>>> Thanks >>>>> Panos >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> -- >>>>> 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: 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. >>>> >>> >>> >>> >>> -- >>> 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/ZtT1SKrw0h8/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. >

Hi All, how far with this update. I am trying to put a default value based on a calculation field but it doesn't seem to work there. Though the calculation field could be referenced in other areas

Please see Is it possible to set a default value for a decimal question using the calculate column? for one strategy.

1 Like