on 11-14-2008 10:51 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
}
}
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.