Is there a simpler way to only ask a question once

The “Common Logic and Calculations” [1] describes a way to only a questions
once. We have taken this approach in our application so far, and it is
working well.

However, I’ve wondered if a simpler approach may be possible and, if not,
why not. In particular, rather than pre-loading the previous answer into a
new form property (e.g. load “had_tt1” into “prev_had_tt1”), why can’t I
simply load the previous value into the same form property. Is this
simply not allowed; is it not possible to have the skip logic reference the
’current’ form property? (if you know what I mean)

Thanks, Ray

[1]

Unfortunately you’ll get an “xpath dependency cycle” error - questions
cannot depend on the answers to themselves.

You can see this if you try it out and then save and exit the form.

··· On Fri, May 18, 2012 at 12:05 AM, Ray Brunsting wrote:

The “Common Logic and Calculations” [1] describes a way to only a
questions once. We have taken this approach in our application so far, and
it is working well.

However, I’ve wondered if a simpler approach may be possible and, if not,
why not. In particular, rather than pre-loading the previous answer into a
new form property (e.g. load “had_tt1” into “prev_had_tt1”), why can’t
I simply load the previous value into the same form property. Is this
simply not allowed; is it not possible to have the skip logic reference the
’current’ form property? (if you know what I mean)

Thanks, Ray

[1] -
https://wiki.commcarehq.org/display/commcarepublic/Common+Logic+and+Calculations


Amelia Sagoff

Ray,

Yeah, Amelia’s correct about the dependency problem. Additionally, even if
this was possible, it would lead to some very odd/possibly incorrect
workflows, since XForms have a completely stateless, declarative model. In
order to make a question not be asked, you make it irrelevant, which also
makes the node disappear completely, so if /data/question was irrelevant if
/data/question != ‘’, then as soon as you answered the question, it would
become irrelevant and disappear forever.

-Clayton

··· On Fri, May 18, 2012 at 12:36 PM, Amelia Sagoff wrote:

Unfortunately you’ll get an “xpath dependency cycle” error - questions
cannot depend on the answers to themselves.

You can see this if you try it out and then save and exit the form.

On Fri, May 18, 2012 at 12:05 AM, Ray Brunsting ray@tula.org wrote:

The “Common Logic and Calculations” [1] describes a way to only a
questions once. We have taken this approach in our application so far, and
it is working well.

However, I’ve wondered if a simpler approach may be possible and, if not,
why not. In particular, rather than pre-loading the previous answer into a
new form property (e.g. load “had_tt1” into “prev_had_tt1”), why can’t
I simply load the previous value into the same form property. Is this
simply not allowed; is it not possible to have the skip logic reference the
’current’ form property? (if you know what I mean)

Thanks, Ray

[1] -
https://wiki.commcarehq.org/display/commcarepublic/Common+Logic+and+Calculations


Amelia Sagoff