Register today for Oracle CloudWorld. October 17th - 20th, Las Vegas

Register now

Hillel Cooperman, Senior VP of User Experience Design, has a message for you on Oracle CloudWorld

Watch now
Best way to output a node even if null? (foreach, choose does not output node as expected) — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Best way to output a node even if null? (foreach, choose does not output node as expected)

Received Response
18
Views
5
Comments
edited Oct 28, 2020 12:06AM in Integration 5 comments

Content

How can I output a node as null if the foreach/choose condition is not met?  Here's the source:

<appt>
   <responses>
      <answer>12312312312</answer>
      <questionExternalID>alternatephonenumber</questionExternalID>
   </responses>
   <responses>
      <answer/>
      <questionExternalID>createdbyuser</questionExternalID>
   </responses> 
</appt>
 
I am attempting to map to this structure when a condition is met:
<response-wrapper>
   <alternatenumber>081111111</alternatenumber>
</response-wrapper>
.. and this structure when it is not met:
<response-wrapper>
   <alternatenumber/>
</response-wrapper>
The problem is that the response node is repeating so I must use a foreach loop.  If I use an otherwise condition the alternatenumber node is output for each of the response nodes present, which is not what I want (I only want 1 alternatenumber node)
Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!