cancel
Showing results for 
Search instead for 
Did you mean: 

how get a unity form field values?

Scott_Johnson3
World-Class Innovator
World-Class Innovator

Hi All

I need to  get a unity form field values?   If I use

string batch_nbr = form.AllFields.Find(BATCH_NBR_FF).AlphaNumericValue;

I get a  warning:

(41,24): warning CS0618: 'Hyland.Unity.UnityForm.Field.AlphaNumericValue' is obsolete: 'Please use ValueFieldDefinition.AlphaNumericValue.'

I can not find any properties under AlphaNumericValue that return a field value. 

FYI ALL THE EXAMPLES IN THE SDK USE THE OBSOLETE PROPERTIES.

Any suggestions?

Scott

1 ACCEPTED ANSWER

Tharon_Rivera
Star Collaborator
Star Collaborator

I was wondering the same thing when using 14 references.  Just ignore [obsolete] warnings and update it when it's actually deprecated. (-:

The previous form.Fields is now preferred to be form.AllFields.ValueFields and form.Repeaters is preferred to be form.AllFields.RepeaterFields.

It looks like UnityForm.Field was made into more of a generic class covering both repeater fields and single value fields.  This probably makes it easier to do something like cascaded repeating sections (ie: a field in a repeating section can now a field in a repeating sub-section...).

TLDR:

Try to use form.AllFields.ValueFields.Find(BATCH_NBR_FF).AlphaNumericValue (assuming batch number isn't in a repeating section).

If you like to try and confuse people (or like parentheses (or casting]), you could get really wild with something like ((ValueField)form.AllFields.Find(BATCH_NBR_FF)).AlphaNumericValue

View answer in original post

3 REPLIES 3

Tharon_Rivera
Star Collaborator
Star Collaborator

I was wondering the same thing when using 14 references.  Just ignore [obsolete] warnings and update it when it's actually deprecated. (-:

The previous form.Fields is now preferred to be form.AllFields.ValueFields and form.Repeaters is preferred to be form.AllFields.RepeaterFields.

It looks like UnityForm.Field was made into more of a generic class covering both repeater fields and single value fields.  This probably makes it easier to do something like cascaded repeating sections (ie: a field in a repeating section can now a field in a repeating sub-section...).

TLDR:

Try to use form.AllFields.ValueFields.Find(BATCH_NBR_FF).AlphaNumericValue (assuming batch number isn't in a repeating section).

If you like to try and confuse people (or like parentheses (or casting]), you could get really wild with something like ((ValueField)form.AllFields.Find(BATCH_NBR_FF)).AlphaNumericValue

Hi Tharon
Thank-you for your post. I took your suggested new construct:

string batch_nbr = form.AllFields.ValueFields.Find(BATCH_NBR_FF).AlphaNumericValue;

and it complied without warning.

Scott

Adam_Ryman
Star Contributor
Star Contributor
Goof Afternoon Scott.

Tharon is correct in his answer below. We now want to use form.AllFields.ValueFields .

I was unable to find the section containing examples with obsolete methods. Can you please further explain where in the SDK you found these code examples containing obsolete methods?

Also, can you please provide which version of the SDK you are accessing?

Thanks,

Adam Ryman
Hyland API Analyst