cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve the value in a calculated field on a Unity form in a Unity script?

Corey_Gillingha
Confirmed Champ
Confirmed Champ

I have a calculated field on a Unity form.  I need to retrieve the value in this calculated field in a Unity script.  The SDK states that you can get the value from a calculated field the same way as any other filed on a Unity form (ex:  form.AllFields.ValueFields.Find(MY_VALUE_FIELD).Value).  However, when I try this I get the following error, "Object reference not set to an instance of an object".  I added some code to display all of the fields on the form and I can see all of the fields with the exception of the calculated field.  I am new to Unity scripts and I am likely missing something simple. Any help that you could offer would be greatly appreciated.

5 REPLIES 5

James_Perry
Elite Collaborator
Elite Collaborator
You may need to copy the value to a hidden field on the form and then retrieve that in your script.
No one person needs to know everything—they simply need to know who knows it.

Corey_Gillingha
Confirmed Champ
Confirmed Champ
Thanks Jim! That's actually what I did to make my code work. However, it is odd that the SDK would clearly state that a calculated field could be retrieved the same way as any other field.
Can anyone from Hyland comment on the validity of this statement in the SDK? I have no issue using a hidden field, I would just like to know if there is another way to do this.

I realize this is several years old, but would either of you be willing to share the code you used to do this?  I am attempting to do the same thing following the SDK as you both did, but I hadn't gotten to your snag  yet.  I'm trying to figure out the syntax to pass the current object in as a form to even loop through the fields in the first place.  If willing, my email address is rob.keberdle@thirdfederal.com.  Thanks!

Still running into this issue in 2021. Very confused on the language of the SDK, it makes the distinction between Table and Repeater values but doesn't suggest anything about calculated fields not working. Very tedious work around.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.