Calculated vs initial value calculations

8 views
Skip to first unread message

Jamian Manton

unread,
Aug 12, 2020, 7:36:45 PM8/12/20
to Orbeon Forms
Hi,

I'm interested in seeking more understanding regarding the difference between the result of Calculated Value fields and Initial Value fields in view mode in the Formula tab.

I have an eform that uses a dataset from an HTTP service for patient data, and at first I used the calculated field to manipulate the data into user friendly format, such as:
concat(fr:dataset('patient')/firstName,' ',fr:dataset('patient')/lastName)for the full name field and:
concat(fr:dataset('patient')/addr1,' ',fr:dataset('patient')/addr2,codepoints-to-string(10),fr:dataset('patient')/city,' ',fr:dataset('patient')/postcode)for the address.

These work fine in edit mode but when displayed in the view mode the results disappear. I know that a calculated field always tries to calculate regardless of the view but I would have thought that the calculation would still return the same result as this does not change. Can someone explain why the data in calculated fields with consistent data does not calculate? Is the dataset unable to be accessed in view mode?

I have since moved the calculations to the initial value field and set it to read only but its the older versions of the form that still display empty fields that are a concern to me and I can't logically see a reason why they do not show the calculated data.

I am on version 2018.1.2.201810050007 PE

Regards

Jamian Manton

bwallis42

unread,
Aug 12, 2020, 8:16:49 PM8/12/20
to orb...@googlegroups.com
Hi James,
I don’t think the dataset is being populated when the form is viewed, I
think that only happens when the form is being edited.

If you do something simple in the calculated and initial value fields, say
‘current-time()’ then you will see the behaviour you expect. So the formulae
is running each time for the calculated field but no data in the dataset.

Brian…

--
Sent from: http://discuss.orbeon.com/

Jamian Manton

unread,
Aug 13, 2020, 1:36:45 AM8/13/20
to Orbeon Forms
Thanks Brian,

I thought this might be the case.

Regards
Jamian
Reply all
Reply to author
Forward
0 new messages