on 07-16-2007 8:34 AM
Hi all, <br>
I need to wright an user defined function to add all the source fields to one target fields. All the fields are integer type. <br>
<u><b>source </b></u>----
<u><b>Target</b></u><br>
Salary_____1...1----
Owner____1...1<br>
payA______0...unbound----
sum______1...1<br>
payB______1...unbound<br>
payC______1...1<br><br><br>
Mapping is ( payApayBpayC ) -> ( user defined fun ) -> sum <br><br>
Please send me the code.<br>I think the Cache type -- Value will not work as the payA can increase at run time(0..unbound). Cache type should be Context or Queue( So that we can refer whole context).<br>I want to know whether this can possible with out user defined function.
See this UDF
int payAsum=0;
for(int i=0;i<payA.length;i++)
{
payAsum =payAsum+Integer.parseInt(payA<i>);
}
int payBsum=0;
for(int j=0;j<payB.length;j++)
{
payBsum =payBsum+Integer.parseInt(payB[j]);
}
result.addValue(payAsumpayBsumpayC+"");
This will be context level function with payA payB payC as input
Mudit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much. <br>
But the last payC"" is not working because that is string. ( If we add 2 and 1 the out put is 21). I have tryed parseInt but i am getting addValue(java.lang.String) in com.sap.aii.mappingtool.tf3.rt.ResultList cannot be applied to (int) result.addValue(payAsumpayBsum+payCsum);. I have tried using Integer.parseInt(payC[0]) and i got error. Please slove this one. <br> Is above issue can be sloved with out any user defined function?
int payAsum=0;
for(int i=0;i<payA.length;i++)
{
payAsum =payAsum+Integer.parseInt(payA);
}
int payBsum=0;
for(int j=0;j<payB.length;j++)
{
payBsum =payBsum+Integer.parseInt(payB[j]);
}
int payCsum=Integer.parseInt(payC[0]);
int total=payAsumpayBsumpayCsum;
result.addValue(total+"");
if the last part also dont work out try result.addValue((String)total);
Mudit
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 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.