on 10-10-2009 10:44 AM
Hi Experts,
I hav a special requirement. source file has 4 fields. .We know at runtime it will carry values....Say at runtime there are 3 rows like this.
F1 F2 F3 F4
1 1 5 6
4 1 4 6
4 5 6 7
Now 1st requirement is to make a mapping which will generate an output as
F1 F2 F3 F4
1 1 5 6
4 1 4 6
4 5 6 7
9 0 3 19 Note taht this last row is added and has some special logic. In the F1 coloumn note taht 9 is actually a summeion of 144. again in the F3 coloumn 3 is the COUNT of total number of rows. . Again in the F4 coloumn , 19 is the sum of the last 3 rows 667. This development i need to do initially.
Then Again there will be another mapping layer where I will be using
F1 F2 F3 F4
1 1 5 6
4 1 4 6
4 5 6 7
9 0 3 19 as source information and an IDOC as target structuture which will get populated with a completely different set of logic.... what i need to know is hw to i create the first mapping that can generate taht extra line ,,,as per the logic described!!!
Thanks in advance to all,, In case of any doubt,, pls revert back !!
Hi,
Here, root context means, that root node contxext has to be assigned to that particular field(F1, F2).
After changing the contexts of the fields to root context, UDF will be applied.
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 Arnab,
LEt your source be
-root
-Details1..unbounded
--F1 1..1
--F2 1..1
--F3 1..1
--F4 1..1
Document Name = root
Document Namespace =xyz.com
RecodsetName = Details
Details.fieldName = F1,F2,F3,F4
Details.fieldSeparator = ','
Details.endSeparator = 'nl'
This make the XML Structure in source side
Now if this is the target structure
-root
-Details1..unbounded
--F1 1..1
--F2 1..1
--F3 1..1
--F4 1..1
-SumF1
-XXX
-CountF3
-SumF4
then the maping logic will be
details (source) --> Details (target)
F1(source)--F1(target)
F2(source)--F2(target)
F3(source)--F3(target)
F4(source)--F4(target)
F1(context root) --> UDF --> SumF1
F4(context root) --> UDF --> SumF4
F3(context root) --> count (node function)-(subtract 1 from this using arithmetic function sub) --> CountF3
The UDF is an advanced udf with all values of queue.
int sum =0;
for (int i=1;i<input.length;i++)
sum += Integer.parseint(input<i>);
result.addValue (sum);
Since you have not given the logic that is required for XXX i have not specified any mapping logic
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Experts / Suraj,
The code is not working. Mine is PI7.0 .I cannot understand what you meant my the following terms.
F1(context root) --> UDF --> SumF1
F4(context root) --> UDF --> SumF4
F3(context root) --> count (node function)-(subtract 1 from this using arithmetic function sub) --> CountF3
Because i am sayiny this after trying only. It is not working . What do u mean by the term Context root.
The given code is also not working
int sum =0;
for (int i=1;i<input.length;i++)
sum += Integer.parseint(input<i>);
result.addValue (sum);
pls suggest experts!
Hi Arnab,
What Suraj means by Conetxt(Root) is to right click on the field and chose Context-> your root element in the mapping editor area.
When you create the UDF, did you chose the Queue radio-button?
int sum =0;
for (int i=0;i<input.length;i++)
sum += Integer.parseint(input);
result.addValue (sum);
Regards,
Ravi Kanth Talagana
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.