How to map Child Object Data from a REST call to a text box or text area in VBCS
(Doc ID 2741512.1)
Last updated on FEBRUARY 06, 2021
Applies to:Visual Builder Studio
Information in this document applies to any platform.
The goal of this tutorial is to display all of the items from a rest endpoint, including the child items, in a text box or text area using an ADP variable.
ADP variables are used most often for list and table collection components, but sometimes we might want to display the info in a text area.
If we try to enter the ADP variable, or any part of it, into the DATA parameter of a text area we will usually see an error so there is a process to follow that gets around this.
In our case, we can see the the REST API has returned the expected data using the console log, however, when we try mapping and assigning variables using the Rest endpoint result, the assignment/mapping fails with an error:
"Cannot read property '<0>' of undefined at eval" and the text area disappears if we try to display this data.
We are seeing an error because we are trying to read an array item that does not yet exist. The UI wants all of the arrays to have something in them at start, because it is trying to populate a text box on application entry time. We can't give the ADP variable a default value to get around this because we end up offset by 1 in the array index; meaning the array ends up with position 0 containing the default data and position 1 onward as the new values from the Rest call.
Text boxes and text fields are not generally meant for this type of usage. If the value is undefined it causes problems and results in the error or the entire text box simply disappearing as the UI tries to populate the field from a blank array.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document