on 02-11-2015 7:41 AM
Hi,
My requirement is if Year (String data type) is between 2001 and 2009 and Price(String again) between 4000 and 6000 then populate the target field with "Okay".
Or if the year is between 2010 and Current Year (Dynamic) and price between 8000 and 10000 then Populate the target field with Okay
if both not satisfied "Not Okay".
Also note that the Year and Price is under Details node, which might have multiple instances in the source.
Can you please help me with UDF for this requirement.
--
Sendhil
Hi All,
I understand, it can be acheived using standard functions, the reason I am asking here is to understand the multiple functions in UDFs.
1. How to acheive the less than and Greater than for string data types.
2. What would be return Value for returning Sting "Okay or Not OKay"
3. UDF is based on Context or Queue, if so how it is handled.
I should have put it in the first place, my Bad.
Inorder to understand these questions, I was asking UDF which would give a clear idea. Please provide your inputs.
My Source Structure.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_SRC_ZIP_FCC xmlns:ns0="http://vodafone.com/sendhil/test">
<Header>
<Brand>Test</Brand>
<Model>Test</Model>
</Header>
<Details>
<Year>1999</Year>
<Price>4000</Price>
</Details>
<Details>
<Year>2000</Year>
<Price>9000</Price>
</Details>
<Details>
<Year>1985</Year>
<Price>1000</Price>
</Details>
</ns0:MT_SRC_ZIP_FCC>
--
Sendhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sendhil,
Use below UDF and execution type is "All Values of Context". Pass year and price fields to the UDF.
public void mapBuyOption(String[] year, String[] price, ResultList result, Container container) {
for (int i = 0; i < year.length; i++) {
int yearInt = Integer.parseInt(year[i]);
int priceInt = Integer.parseInt(price[i]);
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
if ((yearInt >= 2001 && yearInt <= 2009 && priceInt >= 4000 && priceInt <= 6000)
|| (yearInt >= 2010 && yearInt <= currentYear && priceInt >= 8000 && priceInt <= 10000)) {
result.addValue("Okay");
} else {
result.addValue("Not Okay");
}
}
}
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Sendhil,
You can do it with standard functions, try to use the boolean function If and And, also the arithmetic greater and less. You can set the constants with the constant function to set the years.
Check examples here Standard Functions in PI 7.0 - Process Integration - SCN Wiki
And SAP documentation here Standard Functions - Managing Services in the Enterprise Services Repository - SAP Library
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sendhil,
I dont see any multiple occurrences in your structure, if there is no multiple occurrences then you can achieve this with standard functions.
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sendhil ,
i think it is possible with standard functions.
Thanks
Giridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.