cancel
Showing results for 
Search instead for 
Did you mean: 

graphical mapping

Former Member
0 Kudos

hi,

my requirement is in the source i have a field(record type-'L' or 'M'). if i get the record type as 'L' , i have to sum all the fields relating to 'L' , if its 'M' then i have to sum all the fields relating to 'M' & give it to target . can any one suggest me any function in graphical mapping which satisfies my reqt or is it better to go for user-defined function(UDF) . plz suggest if its UDF can u send me the source code for it.

rgds

chaithanya

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member214364
Active Contributor
0 Kudos

Hi,

You want to add integer values or decimal values? and

record type always either only "L" or only "M"?

cheers,

Jag

former_member214364
Active Contributor
0 Kudos

Hi Chaithanya,

Have you got the solution for this,if not could you please send source and target structures.so that we can send you exact UDF code which will be suitable for your scenario.

cheers,

Jag

Former Member
0 Kudos

hi jagadish,

my source fields would be an item fields related to record type 'L' or 'M', so first i should check the condition if its from 'M' or 'L' then i should send the related values with sum of all to target field .

my source file is

000472612420070216WRFCCLGBP 001360000000000445.2320070208

000472612420070216WRFCCLGBP 001360000000000604.0920070209

000472612420070216WRFCCLGBP 001360000000000923.9820070210

000472612420070216WRFCCLGBP 001360000000000438.2820070211

000472612420070216WRFCCLGBP 001360000000000311.7220070212

000472612420070216WRFCCLGBP 001360000000000356.9720070213

000472612420070216WRFCCLGBP 001360000000000202.6720070214

so i should sumup the last values of the file & should give to target if its 'L', if its 'M' then i should sum to related values & give it to target, if u can can send me the UDF code which i have to built that would be great.

rgds

chaithanya

Former Member
0 Kudos

Chaithanya,

You mean you will be getting 'n'( 6 in this example) lines from a file and need to write to a file as a single line with last 6 values sum up .

Please confirm this ...

Nanda

Former Member
0 Kudos

hi kishore,

yes it can be 6 & can change at times , but its an FI issue . so i will be having credit & debit lines based on the (WRFCCL)- identifier i should sum up the value . first i should check the condition is it 'L' or 'M' then i should sum up all the values it can be 6 or n it varies.

rgds

chaithanya

Former Member
0 Kudos

Hi,

I had a similar requirement, to sum credit and debit totals.

I used both partly graphical mapping with a simple custom function.

In the graphical mapping, I used it to check if it is D or C and then called a custom function to add the values.

Code for the custom function:


public void customSum(String[] a,ResultList result,Container container){
BigDecimal sum = new BigDecimal(0);
for ( int i = 0; i < a.length; i++)
{
  sum = sum.add(new BigDecimal(a<i>));
}
result.addValue(sum);
}

You may have tweak the code a bit. I have this code in a custom package and I stripped of all the unneccasary stuff and gave you the main part of the method.

Hope this helps,

Sumant.

Former Member
0 Kudos

hi sumant,

thnks for the response but i should check the value D or C in the custom function(user-defined function) itself. my requirement is i will be getting 6 value at a time first then i should check whether its D or C & then sum up all values . should i code in the UDF itself . plz revert me back.

rgds

chaithanya

Former Member
0 Kudos

Hi Chaitanya,

This can be attained using UDF but to do with only graphical mapping need more info with example. Provide us with the sample data structures of source and target so that can give better solution .

Nanda

Former Member
0 Kudos

hi sumant,

plz do go thru my source file

my source fields would be an item fields related to record type 'L' or 'M', so first i should check the condition if its from 'M' or 'L' then i should send the related values with sum of all to target field .

my source file is

000472612420070216WRFCCLGBP 001360000000000445.2320070208

000472612420070216WRFCCLGBP 001360000000000604.0920070209

000472612420070216WRFCCLGBP 001360000000000923.9820070210

000472612420070216WRFCCLGBP 001360000000000438.2820070211

000472612420070216WRFCCLGBP 001360000000000311.7220070212

000472612420070216WRFCCLGBP 001360000000000356.9720070213

000472612420070216WRFCCLGBP 001360000000000202.6720070214

so i should sumup the last values of the file & should give to target if its 'L', if its 'M' then i should sum to related values & give it to target, if u can can send me the UDF code which i have to built that would be great.

rgds

chaithanya