cancel
Showing results for 
Search instead for 
Did you mean: 

Separate Response from an Adaptive Web Service Model

christianmesser
Employee
Employee
0 Kudos

Hi,

A WebService returns me a list of Outbound and Inbound flights (all in one list). Now i want to separate the Inbound and the Outbound flights into two tables. One parameter is different, so its easy to define the separation.

But how can i do that?

Ideas

a) Copy the whole response and delete the inbounds on one table and the outbounds on the other?

b) splitting the Response (what ever that means)

c) define filter on both table?

Regards,

Chris M

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Better way should be to split the response. You get the resultset in a node. So you may traverse through the elements in the result (looping) to check if any element has data of an outbound flight.

If it has, you can copy it to a new element of a separate context node... and so on.

Similarly you can have a node containing elements with data pertaining to inbound flights.

Inbound node and Outbound node could be bound to different tables.

Others may have more ideas on this..

Regards,

Anagha

christianmesser
Employee
Employee
0 Kudos

Thank you

Here the code to the description from Anagha,

public void split( ) {

int n = wdContext.nodeResponseIn().size();

for (int i = n - 1; i >= 0; i--) {

// Sorting the entries with the parameter "O" for Outbound

if(wdContext.nodeAvt_In().getResponseInElementAt(i).getDirection().equals("O")) {

//Creating a new Element in the "Out" Node

wdContext.createAndAddResponseOutElement();

//Move the "current" Node to the new created Node

wdContext.nodeResponseOut().moveNext();

//Copy Elements from the "In" Node to the "Out" Node

wdContext.currentResponseOutElement().setArr(

wdContext.nodeRsponseIn().getResponseInElementAt(i).getArr());

...

...

}

//Remove the "Out" Element from the "In" Node

wdContext.nodeAvt_In().removeElementAt(i);

}

}

Answers (0)