cancel
Showing results for 
Search instead for 
Did you mean: 

Blank repeater fields causing error

Michael_Butt1
Star Contributor
Star Contributor

Hello,

I have written a script that loops through repeater fields and outputs the repeater values to a list of values in a Word document. However, if a user adds a blank repeater line, my script errors with the exception: 

Value was not set. 

System.InvalidOperationException: Value was not set.
   at Hyland.Unity.UnityForm.Field.get_Value()

The exception occurs at the "for each" line:

For each field as Hyland.Unity.UnityForm.Field in repeaterItem.Fields
  'write the fields to a pipe separated string
Next

The problem I'm having is that I don't know how to check to see if values are empty prior to looping through the fields. I've tried using the field.isEmpty property after the "For Each", but the error occurs prior to that check.


How do I check to see if a value has been set in a repeater field prior to looping through? I could not get a check at the "repeaterItem" level to work either.

Thanks

4 REPLIES 4

Patrick_Ramser
Star Contributor
Star Contributor
Hm. That's not good.

If the issue is happening during the iteration of the list under this condition, it sounds like something that could technically be a larger issue. Provided you are API certified, I would suggest contacting apisupport@onbase.com for some help in figuring out what the cause of this is.

Thanks for the response Patrick. I will not have the opportunity to get API certified until later this year, but I will ask the question via one of our other certified people.

Is the expectation that the repeater iterations handle blank entries without a check, or do I need to make some kind of check before looping through each value? 

Patrick_Ramser
Star Contributor
Star Contributor
I could be wrong, but I believe the repeater fields should still iterate even if they don't have a value. You would have to trigger the iterator anyways to check for a null value ahead of time, so something doesn't quite seem right.

got it, thank you. I will validate through API support.