on 12-03-2009 2:33 PM
Hello experts,
In my source structure I have 38 elements (number can vary) to map.
But I only want to map the first 15 elements.
In another step I want to map the next 15, so 16-30.
And in another step I want to map the rest, so element 31-38.
I somehow need a function I think that I can tell to take 1-15 and in the next mapping step I tell it to take 16-30 and at last 31-38.
Can I achieve that with graphical mapping? Does anyone have an idea?
Thank you,
Peter
Hi Peter,
Its possible when in the target side there is no mandataory (occurance is 1..1 or 1..unbounb) fields are exists or no mandatory segments exists.
You can do this also, you can duplicate the target structure 2 times (total 3 structures) then first time you can map the first 15 fields and second time you can map next 15 and so on. But this is the single mapping.
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In that case, You need to build a UDF to make the split.
public void printRange(String[]list, int start, int end, ResultList result, Container container){
if(list.length < end){
end = list.length;
}
if(list.length - 1 < start){
start = list.length -1 ;
}
for(int i = start ; i < end ; i++){
result.addValue(list<i>);
}
}
Sorry,
I forgot it,
Try with this,
public void printRange(String[]list, String starts, String ends, ResultList result, Container container){
int start = Integer.parseInt(starts);
int end= Integer.parseInt(ends);
if(list.length < end){
end = list.length;
}
if(list.length - 1 < start){
start = list.length -1 ;
}
for(int i = start ; i < end ; i++){
result.addValue(list<i>);
}
}
Regards
Ivan
Hi Peter,
No need to divide/split the source message, three times [ you are doing the mapping 3 times] (in the mapping) you can use the same sender structure, but every time in the mapping you can map what ever fields are required. the remaining fields you can leave.
In the java UDF, by default every thing treated as a String, so if you want to use int or float .. then we have to do the conversion.
int i= Integer.parseInt(input_data);
Regards
Ramesh
Hello Ivan,
Thanks again!
Somehow I can only create the following method head
public void printRange(String[] list,String[] starts,String[] ends,ResultList result,Container container){..}
And then I tried to convert "starts" and "ends" to "int":
int = Integer.parseInt(starts[]);
int = Integer.parseInt(ends[]);
but I get the following errors (the same for starts as well):
not a statement
int = Integer.parseInt(starts[]);
^
';' expected
int = Integer.parseInt(starts[]);
^
Could you help me again, I don't know what could be wrong here!
Thank you!
Peter
Hello Ramesh,
Thank you for your answer as well. I do have the same sender structure.
But I also need the target structure numerous times because the target structure is limited to 15 nodes.
If my source occurs more than 15 times I need the target more than once!
Thank you and best regards,
Peter
Hi,
I do not understand What You need exactly. However You can explore multimapping option to generate more than one output file, another option is splitter your message using some module in the channel, finally You can use BPM functionality.
Regards
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.