on 02-08-2014 9:24 AM
Please let me know how his can be done in PI
My requirement in pi mapping that I need to do with both the ways with message mapping as well as java udf .
1)Requirement
Column 1 Column 2
Indicator Batch number
P 6C8
R 6C8
P 6Q7
R 6Q7
P 6Q7
R 6Q7
P 6R1
R 6R1
P 6R1
R 6R1
T 10
If the indicator is P or R the Batch Number value should be passed to target side batch number field .Otherwise if it's T the total number of record should be passed to another field "Record_Count" on the target side .
2)Requirement
Column 1
Column 1 Column 2
Indicator Amount
P 50173.44
R 78173.41
P 3500000
R 10000
P 1000
R 1000
P 91000
R 950001
P 91000
R 108069.39
T 607069.45
If the indicator is P or R the Amount value should be passed to target side Amount field if the Record indicator is T
the sum of all the Amount should be passed in Amount amount field
Thanks
Hello,
Check below mapping:
Note - I am only proving u graphical mapping, in case u are interested in doing below req. using UDF also then try to write it on ur own and get back here in case of any issues.
Requirement 1: Right click on MT name -> and select "Add Variable" -> name it as "var"
Requirement 2:
Most of the mapping will remain same as that of above, but only mapping of variable "var" will change
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anshu - When the indicator is T-> Do you want the sum of all the amounts or just the sum of the amounts for which the indicator is T?
If you want the sum of all the fileds then just change the "var" mapping to below
amount->removecontext->sum->var
and below the mapping for your target amount field .. (i assume these indicators or fixed P/R/T)
Hi Hareesh and Amit ,
Thanks.
It works .My question to you now is that If you see the sample the record T is the end of record indicator (sort of total ) which will be having no value against batch number and amount .
Now with the above mentioned mapping I had to give values against batch number and amount in the last record also which should be not there Also last record T should not be counted in total number of records (for sample record Total number of records should be 10 but this is coming 11).If I am not giving any value it will throw an error.
Please let me know what should be done .
Hello,
>>Now with the above mentioned mapping I had to give values against batch number and amount in the last record also which should be not there
Not sure what u meant by this? Could u please be bit more descriptive?
>>Also last record T should not be counted in total number of records (for sample record Total number of records should be 10 but this is coming 11).
So, If i understood u correctly last record for T would itself contain total number of record i.e. 10 (highlighted below)?? In addition to that i assume, that only one T record will come in ur input message?
If yes, then for Rec_Count target field mapping just map "BatchNumber" (which is nothing but 10 in ur example) to "Then" argument (in IfWithoutElse)
Column 1 Column 2
Indicator Batch number
P 6C8
R 6C8
P 6Q7
R 6Q7
P 6Q7
R 6Q7
P 6R1
R 6R1
P 6R1
R 6R1
T 10
Thanks
Amit Srivastava
Hi Anshu,
you can achieve this with standard functions.
1. you are going to need functions equals,if ,ifwithoutelse and count functions
2. here instead of count use sum function with above mentioned functions.
take a help from this link.
Standard Functions in PI 7.0 - Process Integration - SCN Wiki
if this does not help please share the input and output xml here.
Regards,
Muni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.