on 01-06-2016 4:53 PM
Hi Experts,
Currently in production we have an interface which is failing in mapping daily, because one field is coming as Alphanumeric and that field is used in subtraction/Addition functionality in many fields in the mapping.
Mapping is quite complex and the clients are not ready to make changes in the current mapping.
So, as a workaround we decided to add another mapping(Graphical/XSLT/Java) before our current mapping(in Operational Mapping).
Mapping needs to handle
** To check that field(LtNumber) if it is alphanumeric say(W708088), then we need to delete the LtNumber field from the source payload and pass the entire payload as it is to our second mapping(current mapping).
Please suggest how I can handle it in an appropriate way and performance is also not affected.
Thanks,
Nidhi
Hi Nidhi
Create a udf to check the alpha numeric value.
LtNumber-->UDF-->target field.
UDF Code:
try{
int i = Integer.parseInt(var1);
}
catch(NumberFormatException e){
return "0";
}
return var1;
Regards
Osman Jabri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Thanks for your response.
Again a confusion is like -
IF I am adding a map(1-1, just removing the field if it is alphanumeric) before the main map(currently existing), will it impact performance or delay the messages?
Is it better to go for Graphical mapping or I can think for Java/XSLT from performance point of view?
Please suggest.
Thanks,
Nidhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nidhi,
Check the below benchmark for the mapping programs comparison. I'm not sure what's the msg size/ or no.of transactions per day . But I would say Graphical mapping should be okay in my opinion.
Comparing Performance of Mapping Programs | SCN
Also on the side note, when you are doing the calculation using Integer.parseInt you are type casting the string to Integer as you know it, just make sure what's your biggest number looks like.. Again I don't know the data, if it's really really big then you will get type casting error and you will get "0" as a result. Please watch out this one!
>>>>IF I am adding a map(1-1, just removing the field if it is alphanumeric) before the main map(currently existing), will it impact performance or delay the messages?
I would say add this logic in your current mapping program .. You are definitely adding overhead to the process because the client thinks it's complicated program and don't want to touch it. I would say convince them and add the logic in the current program and do more testing.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nidhi,
Do you need to delete the entire field or only delete the value within tags?
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nidhi,
In the first mapping for the LtNumber field use the below UDF and logic
for (int i=0; i<input.length(); i++) {
char c = input.charAt(i);
if (c < 0x30 || (c >= 0x3a && c <= 0x40) || (c > 0x5a && c <= 0x60) || c > 0x7a)
return false;
}
return true;
}
Input------->UDF----->CreateIF------>LTNumber.
Let us know if you face any issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghu,
I tried your code, edited a bit in the function definition -
public String createTargetCheck(String input, Container container) throws StreamTransformationException{
for(int i=0;i<input.length();i++)
{
char c = input.charAt(i);
if (c < 0x30 || (c >= 0x3a && c <= 0x40) || (c > 0x5a && c <= 0x60) || c > 0x7a)
return "false";
}
return "true";
}
But the result is showing as true, either i pass numeric or alphanumeric.
Please suggest.
Thanks,
Nidhi
Hello Nidhi,
Try the below piece of code
public String createTargetCheck(String input, Container container) throws StreamTransformationException{
int flag = 0;
for(int i=0;i<input.length();i++)
{
char c = input.charAt(i);
if (c < 0x30 || (c >= 0x3a && c <= 0x40) || (c > 0x5a && c <= 0x60) || c > 0x7a)
flag=flag+1;
}
if(flag>0)
{
return "false";
}
else
{
return "true"
}
}
Let me know if you face any issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Justin,
Thanks for your reply.
I am adding the function, but its resulting into array index out of bound error.
The value coming in the source field is alphanumeric say W7080AA.
Any suggestion?
Thanks,
Nidhi
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.