on 10-13-2009 1:24 AM
say there are 2 input and 2 output fields
The first input field is mapped to the first output field , after grouping similar values together
e.g:
input field1 output field1
a a
d a
e d
c d
d c
e e
a e
Now the 2 nd input field has to be mapped to 2nd output field according to the order in which the 1st field has been mapped.
We can not use sortByKey here as the first field is not mapped in lexographical nor numerical order.
How then can we map the 2nd field according to order of first?
Thanks in advance
Pratichi
Java Collection Framework might be helpful in your case.
Say, the second input (input2) should be ordered first input (input1). Create a Java Map. This Map should have input1 as key and String array as value. The string array will have output1, input2 and output2.
Get the outputs and place them in their respective placeholders. Finally sort the map on the key.
NB: Make appropriate modification if the above scenario is not an exact match to your requirement.
Hope that helps.
Regards,
Sumant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pratichi,
can you show me the test case output for second filed also as per the first field
Madhav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pratichi,
The UDF that you are writting to group similar values together for the input field1.
try chaging that UDF with two arguments
1. inputField1
2. inputField2
use the concept of Edit Java section(Declaring Global variable .To Know more about it refer
http://wiki.sdn.sap.com/wiki/display/stage/UsingEditJavaSectioninMessageMapping)
Declare a Global variable in the Global Variable section as
String[] format = new String[30];
while you are gouping inputField1 ,group inputField2 also and store in the global variable format.
Write one more UDF to read values from the global variable and map it to OutputFiled2.
(you can use same java code as you normally use to store and read values from the string array).
Thanks and Regards,
Kubra fatima.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pratichi,
Ok.But 1 confusion.
Here, For Input field 1 ,are you using 'Sort' function?
Regards,
Supriya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pratichi,
Can you pls tell, what logic have you applied for mapping Output field1?
Regards,
Supriya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.