cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping requirement

former_member650236
Participant
0 Kudos

Hi Experts,

I am getting a file with 2 details like header and transaction.

Header

EmpCode   EmpAcc  EmpTotalAmount

Details:

EmpName   Empsalary

EmpName   EmpSalary

Sometimes the files comes only with one emp details and sometimes it comes with 10..15 emp details.

My requirement is to calculate the empsalary amount and map it to the header Emptotalamount field.

How can I achieve the requirement, because the details of the employee comes only when I duplicate the mapping and gives the values of the souce side.

Regards,

Shaik

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Shaik,

Try this mapping:

Empsalary -> mapWithDefault:0 -> removeContext -> sum -> EmpTotalAmount.

sum can be found on the Statistic function in message mapping.

Regards,

Mark

former_member650236
Participant
0 Kudos

Hi Mark,

Your answer is correct but am getting my data as Ex: 4000,50 instead of decimal am getting , the mapping is failed when i am using sum.

Input data is header level 4000,50

Employee salary is getting like 2000,00

Employee1 salary is getting like 2000,50 , is not calculating in the sum i tried using format number also.

How can we achieve it please

Regards,

Shaik

markbernabe
Active Participant
0 Kudos

Hi Shaik, Have you tried the replaceString function to convert ',' to '.' to make it decimal?

former_member650236
Participant
0 Kudos

Hi Bernabe,

Ex: Input data is  salary1000,00

Here i have to take only 1000,00 I used substring for the value and i have to sum this value to Footer node employee salary(used Removecontext).

Empsalary->substring(7..0)->removecontext->sum-->formatnumber,##->Empsalary

But it wont works replacestring is throwing error.

Regards,

Shaik

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Shaik,

Can you show us your mapping? replaceString is working fine in my system.

Regards,

Mark

markbernabe
Active Participant
0 Kudos

Hi Shaik,

Can you try

Empsalary -> removeContext -> substring -> replaceString -> sum -> Empsalary 2nd and 3rd parameters for replaceString is constant="," and constant="."

former_member650236
Participant
0 Kudos

Hi Mark,

when i calculate the value 9000,00 am getting output value as 9000 but i want ,00 also.

Regards,

Shaik

markbernabe
Active Participant
0 Kudos

Hi Shaik, You can add the formatNumber function after the sum.

markangelo_dihiansan
Active Contributor
0 Kudos

Yup something like the one above as Mark said.

markbernabe
Active Participant
0 Kudos

Hi Shaik, Mark D provided you with the correct mapping answer. I just answered some of your queries 🙂

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Shaik,

Can you please show us the graphical representation of sender and receiver structures from ESR message mapping

As per my understanding..we can use UDF for the EmpSal (sender field) to the EmpTotalSal (receiver filed).

int totalSal=0;

for(int i=0;i<var1.length;i++)

{

totalSal=totalSal+Integer.parseInt(var1[i]);

}

result.addValue(totalSal);

If this is not the case then give us  one scenario with some sample data and also graphical structure of the sender and receiver(from MM).

Thanks

Pavan