Calculated vs initial value calculations

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Calculated vs initial value calculations

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/2d4b6ab1-6509-4bb9-8b93-cccb013b0296o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Calculated vs initial value calculations

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1597277807591-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Calculated vs initial value calculations

Jamian Manton
Thanks Brian,

I thought this might be the case.

Regards
Jamian

On Thursday, August 13, 2020 at 10:16:49 AM UTC+10, bwallis42 wrote:
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: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/f4a6a2b8-b302-4b3c-b858-562d4e318569o%40googlegroups.com.