on 02-14-2008 6:44 PM
source:
<Row>
<date>20070101</date>
<company>1000</company>
<amount>100.00</amount>
<Row>
<Row>
<date>20070101</date>
<company>1000</company>
<amount>200.00</amount>
<Row>
<Row>
<date>20070101</date>
<company>2000</company>
<amount>500.00</amount>
<Row>
<Row>
<date>20070101</date>
<company>2000</company>
<amount>600.00</amount>
<Row>
<Row>
<date>20061220</date>
<company>3000</company>
<amount>50.00</amount>
<Row>
<Row>
<date>20061220</date>
<company>3000</company>
<amount>10.00</amount>
<Row>
expected target:
<Row>
<company>1000</company>
<date>20070101</date>
<amounts>
<amount>100.00</amount>
<amount>200.00</amount>
</amounts>
</Row>
<Row>
<company>2000</company>
<date>20070101</date>
<amounts>
<amount>500.00</amount>
<amount>600.00</amount>
</amounts>
</Row>
<Row>
<company>3000</company>
<date>20061220</date>
<amounts>
<amount>50.00</amount>
<amount>10.00</amount>
</amounts>
</Row>
I need the mapping step(s) for the date field. The company is mapped when there is a change in company and till that change, the amounts are correspondingly moved. How do I do this with the date that corresponds with a particular company?
Hi,
You need to do this with the help of UDF mapping.
In Udf you need to imply the logice such a way that the Amounts will be rearranged as per the company.
For e.g. Check for company 1000 and then add corresponding amount field in result list.after change in company code add the context change, thus the receiver structure can be achived
If you have time let me know I could develop similar Java code for you and share with you. (It will bit time consumable activity due to take some time from my daily routine work ...:-)) )
Thanks
Swarup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please find her ewith you the udf code for Amount field
Here pass Company as A and Amount field as B.
The below Udf is for amount field
String Company = new String(A[0]);
for(int i=0; i<A.length;i++)
{
if(Company==A<i>)
{
result.addValue(B<i>)
}
else
{
Company = A<i>;
result.addContextChange();
i--;
}
}
Please check the syntax of the code.
UDF for Company field or Date field as A
String temp = new String(A[0]);
for(int i=0; i<A.length;i++)
{
if(temp!=A<i>)
{
result.addValue(B<i>)
result.addContextChange();
}
}
thanks
Swarup
James,
Here you go.
Mapping
http://www.flickr.com/photos/8764045@N06/2264815255/sizes/o/
Results
http://www.flickr.com/photos/8764045@N06/2264815257/sizes/o/
raj.
Hi,
I think you can perform it with nodefunctions by using
Use these one for company code
RemoveContext
Sort
SplitByValue (on ValueChange)
CompCode ---> RemoveContext ---> Sort ---> SplitByValue (on Value Change) -
> TargetNode
Use these one for amount and date as well
FormatByExample (in the upper box map Amount ---> RemoveContext and lower box map company code with the same functions as mentioned avove) -
> TargetNode.
While using FomatByExample, context should be same.
Do same for date.
This is a general idea, u have to think a bit abt it and then i guess u can achieve the goal.
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
James,
Are u sure that company will always come in sequential order, I mean
Company ID
1000
1000
1000
Change in Company ID
2000
2000
Plz confirm that u won't get the data in below sequence
Company ID
1000
1000
Change in comp ID
2000
2000
Change in comp ID
1000
1000
raj.
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 | |
24 | |
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.