What is the use case of Data Node and Group?

I have a bunch of extraced XForms from CCHQ 0.9. I can see lines like:

and

Is it related to the ‘Group’ type question at CCHQ 1.0?
Also, what is the use case of ‘Data Node’ type question? How can I set
conditional value to a data node?

<bind nodeset=“hi_risk” calculate="if(/sampledata/case/update/prp_hrk=1,

‘yes’,‘no’)"/>

Now, if I create a ‘Node Data’ and add
’if(/sampledata/case/update/prp_hrk=1, ‘yes’,‘no’)’ to calculate logic
should it work? What value type should I select (boolean,string etc)?

relevant="…/hi_risk = ‘yes’

If I set this logic in another prompt, should it work?

··· -- Sincerely, Sazzad Bin Kamal

Hey Sazzad,

It is indeed related to the “group” question type that you see in Vellum on
CommCareHQ. If you create a “group” in Vellum, and then inspect the xform,
you should see the appear.

A data node is a node in the form that does not appear on the phone’s
screen when you run the application. Data nodes are useful when you want
to calculate a piece of data in the the form, but not necessarily display
it to the user. This makes it useful mainly for two things:

  1. When you want to load a value from the case data into the form. Then
    you can use this piece of case data for skip logic or display in the form.

  2. When you want to calculate a value in the form. You can then save this
    value to the case as case data or use it for skip logic in the form. For
    example, if you’re collecting data “date of last menstrual period”, you can
    calculate the expected delivery date in a data node and save that to the
    case.

I would recommend using the “data node” question type in Vellum. This
automatically creates a node for you in the model at the top (<hi_risk>).
It also autmatically creates the correct bind: . When you add the calculate in vellum, the bind
will look like:

<bind nodeset="/data/hi_risk" calculate="if(/data/case/update/prp_hrk=‘1’,
‘yes’, ‘no’). The type depends on what calculation you’re doing, but you
can cast the data node any type you like and specify “type” attribute in
the bind. I think by default it’s a string.

Amelia

··· On Tue, Nov 29, 2011 at 6:12 AM, Sazzad wrote:

I have a bunch of extraced XForms from CCHQ 0.9. I can see lines like:

and

Is it related to the ‘Group’ type question at CCHQ 1.0?

<bind nodeset=“hi_risk” calculate="if(/sampledata/case/update/prp_hrk=1,

‘yes’,‘no’)"/>

Now, if I create a ‘Node Data’ and add
’if(/sampledata/case/update/prp_hrk=1, ‘yes’,‘no’)’ to calculate logic
should it work? What value type should I select (boolean,string etc)?

relevant="…/hi_risk = ‘yes’

If I set this logic in another prompt, should it work?


Sincerely,
Sazzad Bin Kamal