Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Iterate Output Collection of DB Adaptar

Muhammad Shaheen AkhtarMay 6 2020 — edited Jun 22 2020

Hi,

I hope everyone is fine and in good health. I am using JDeveloper 12.2.1 for Oracle SOA and using DB Adaptar for back end and REST service for front end. My requirement is to iterate DB Adaptar output with a twist.

For example the DB Adaptar returns below:

{

  "OutputCollection" : [ {

    "DepartmentId" : 10,

    "DepartmentName" : "IT",

    "EmployeeName" : "ABC"

  }, {

    "DepartmentId" : 10,

    "DepartmentName" : "IT",

    "EmployeeName" : "DEF"

  }, {

    "DepartmentId" : 10,

    "DepartmentName" : "IT",

    "EmployeeName" : "GHI"

  }, {

    "DepartmentId" : 20,

    "DepartmentName" : "ADMIN",

    "EmployeeName" : "JKL"

  }, {

    "DepartmentId" : 20,

    "DepartmentName" : "ADMIN",

    "EmployeeName" : "MNO"

  }, {

    "DepartmentId" : 30,

    "DepartmentName" : "MARKETING",

    "EmployeeName" : "PQR"

  } ]

}

So what should i need to do in transformation file or elsewhere to return as below from REST Service:

{

  "DepartmentCollection" : [ {

         "DepartmentId" : 10,

         "DepartmentName" : "IT",

               "EmployeeCollection" : [ {

                    "EmployeeName" : "ABC"

                      }, {

                    "EmployeeName" : "DEF"

                      }, {

                    "EmployeeName" : "GHI"

            } ], {

      "DepartmentId" : 20,

       "DepartmentName" : "ADMIN",

                    "EmployeeCollection" : [ {

                         "EmployeeName" : "JKL"

                           }, {

                         "EmployeeName" : "MNO"

                   } ], {

      "DepartmentId" : 30,

      "DepartmentName" : "MARKETING",

                    "EmployeeCollection" : [ {

                         "EmployeeName" : "PQR"

                      } ]

  } ]

}

Thanks in advance.

Comments

Please Help. How should i achieve this usecase.

Mr.Enzo

Hi , I think first you should have a look to the rules for posting,

you're not making a proper question.

Aside from that I think you could achieve this by doing an xslt transformation from you database collection to your output schema.

All the best,

Enzo Godoy.

Muhammad Shaheen Akhtar

Dear Enzo,

Thanks for your feedback. Can you help me in this matter that how can i use xslt transformation to achieve the output.

Regards,

1 - 3

Post Details

Added on May 6 2020
3 comments
204 views