on 03-04-2014 7:07 AM
Hi Experts,
Kindly share any udf to send the multilple field value to one field N to 1 mapping.
For Ex:
File RFC
1.Emp_Name
2.Emp_ID
3.Emp_Address to Employe_Details
4.Emp_contact
5.Emp_grade
The five fields of employee need to send through Employee_details field of RFC.
Best Regards,
Monikandan.
Dear Experts,
I have tried and develop this udf for multiple field to one context field,when i going to test this udf PI server get down.
I have tested for 5 times and the PI server getting down simultaneously
Kindly explain why this happen?
AbstractTrace trace= container.getTrace();
int i = 0;
String temp = a[0].toString();
trace.addInfo("temp"+temp);
trace.addInfo("length "+temp.length());
for(i = 0;i<temp.length();i++)
{
trace.addInfo("i"+i);
i = temp.indexOf(',');
}
result.addValue(temp.substring(0,i));
Best Regards,
Monikandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Monikandan,
I don't know how well I understood the usage of your UDF. It seems you have more than 1 ',' in string temp.
If yes, then I see a problem in statement i = temp.indexOf(',');
This will always find the first occurence of ',' in string temp. Thus, it will set the value of i to that index value and even though i++ is there, it will still bring the value of i back to that index. Hence, the control will never get out of the loop.
Suggest you to verify this once. This infinite loop might be bringing the box down.
Hi Abhishek,
Thanks for your reply,I am not sure in UDF.
If you can,Kindly provide the udf for the above mentioned requirement.Highly appreciable.
Source data:
Required:
I need to take the first row of data and pass it to RFC CHAR field in separate context like below
CHAR Field:
Emp_Name
Emp_ID
Emp_Address
Emp_contact
Emp_grade
Then need to take the Second row of data and pass it to RFC Value field in separate context like below
Moni
45653
TN
34545465
B
Note : The source data always in a two row like above
Finally i need to update in ECC through RFC like below
CHAR: Value:
Emp_Name Moni
Emp_ID 45653
Emp_Address TN
Emp_contact 34545465
Emp_grade B
Best Regards,
Monikandan.
Hi Moni,
Please use the below mapping...
UDF
String[] vals = a[0].split(",");
for(int j=0; j<vals.length; j++){
result.addValue(vals[j]);
}
For root note do the same mapping but dont use splitbyvalue function...
Testing in mapping its work fine for me...
Result:
I have taken as a example... It is working fine for mee...
Thanks,
Sreenivas
Hi Monikandan,
Create an UDF with 5 string variables, and enter the below code in it.
------------------
String result = "var1"+" "+"var2"+" "+"var3"+" "+"var4"+" "+"var5";
return result;
--------------
Then close it. you will get an udf, the same udf you can use for both target fields, and it takes 5 arguments at source side, just map all the 5 fields you want to combine.
Regards,
Nagesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear all,
My requirement is below:
1. Source data:
2. Created source and Target structure:
Required:
I need to take the first row of data and pass it to RFC CHAR field in separate context like below
CHAR Field:
Emp_Name
Emp_ID
Emp_Address
Emp_contact
Emp_grade
Then need to take the Second row of data and pass it to RFC Value field in separate context like below
Moni
45653
TN
34545465
B
Note : The source data always in a two row like above
Finally i need to update in ECC through RFC like below
CHAR: Value:
Emp_Name Moni
Emp_ID 45653
Emp_Address TN
Emp_contact 34545465
Emp_grade B
Kindly share your ideas how to achieve this.
Is there any UDF to achieve this let me know.
Best Regards,
Monikandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Create your sender structure as
Record
... Data 0 to unbound
Do the simple FCC and your input xml will be like this
<Record >
<Data> Emp_Name,Emp_ID ,Emp_Address ,Emp_contact ,Emp_grade</Data>
<Data> Moni,45653,TN,34545465,B</Data>
</Record>
Then use node function copyValue
Data---> CopyValue (0) ----> Char
Data---> CopyValue (1) ----> Value
Let me know if any doubts.
Hi Indrajit,
After applying the FCC and the above mapping i am getting the below output.
output:
Note: Upto the above output i have done already
What i need from the output i have to split the field value one by one from the row and send it through RFC.
Kindly let me know how to acheive this by way of Java mapping or any UDF suggest me.
Best Regards,
Monikandan
Hi ,
You can use another mapping ..
Source as a file with single field and target as RFC.
for that field to RFC you can map like this.
String[] out = a[0].split(",");
for(int j=0; j<out.length; j++){
result.addValue(out[j]);
}
here you have to map like this...
Record ----> UDF -----> Copyvalue(0) ----> field1 (RFC)
Record ----> UDF -----> Copyvalue(1) ----> field2 (RFC)
Record ----> UDF -----> Copyvalue(2) ----> field3 (RFC)
Record ----> UDF -----> Copyvalue(3) ----> field4 (RFC)
For not reading the first line in the field u can you document offset as 1 for the new sender communication channel....
Please let me know if you require anythign...
Thanks,
Sreenivas
Hi Venkat,
I have tried and develop this udf for multiple field to one context field,when i going to test this udf PI server get down.
I have tested for 5 times and the PI server getting down simultaneously
Kindly explain why this happen?
AbstractTrace trace= container.getTrace();
int i = 0;
String temp = a[0].toString();
trace.addInfo("temp"+temp);
trace.addInfo("length "+temp.length());
for(i = 0;i<temp.length();i++)
{
trace.addInfo("i"+i);
i = temp.indexOf(',');
}
result.addValue(temp.substring(0,i));
Best Regards,
Monikandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create Source structure as
Record
1.Emp_Name
2.Emp_ID
3.Emp_Address
4.Emp_contact
5.Emp_grade
Now u can map Record -----> Employee details (here Just right click on Record field and select option ReturnasXML).
Please let me know still if you face an issue...
Thanks,
Sreenivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Note: Without using BPM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Monikandan,
What is your requirement exactly?
For N:1 mapping you require BPM .
For example From one system you are getting employee education details and from other system you are getting employee work experience details.You want to club both these based on employee id and send to target .In this case you require BPM (Mandatory).
For example you are getting some details from 1 system and you want to club say address details with some delimiter then you can achieve this using std concat fn no need to use bpm for this.
Regards
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
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.