cancel
Showing results for 
Search instead for 
Did you mean: 

How to Check whether incoming field is Alpha or Nuemeric in Mapping

Former Member
0 Kudos

Hi all,

I have the logic like this

If the incoming Location code value is totally Alpha means i have to concatenate Location code and the last three digits of Delivery No. else pass the location code as it is

Regards

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

closing thread to open new one

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Vamsi,

use this UDF it will work fine ,i tested in eclipse

Fist pass the two arguments as input to UDF one is LocationCode and Delivery No

(String LCode,String DevNo,Container.)

if (LCode.matches("[a-zA-z]")) {*

Sring Out = LCode+Dev.substring(0,3);

return Out;

}

else

{

return LCode;

}

let me know the length of Delivery Number,if it is constant value then you need to chnage the substing function index.

Former Member
0 Kudos

Hey Raj,

thank you so much for the reply, i will try and keep you posted

Regards

rajasekhar_reddy14
Active Contributor
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi raj,

I wrote the code like this and getting this error

cannot resolve symbol

symbol : class Sring

Sring Out = LCode+DevNo.substring(8,10); ^ 1 error

Code is

public String LCode(String LCode,String DevNo,Container container){

if (LCode.matches("a-zA-Z"))

{

Sring Out = LCode+DevNo.substring(8,10);

return Out;

}

else

{

return LCode;

}

Former Member
0 Kudos

"Sring Out = LCode+DevNo.substring(8,10);"

It should be "String" not "Sring"...

Former Member
0 Kudos

Hi Raj,

I wrote the code as you instructed bellow and i am getting the Suppressed values when i check the Display Queue in message mapping.

public String LCode(String LCode,String DevNo,Container container){

//write your code here

if (LCode.matches("a-zA-z*"))

{

String Out = LCode+DevNo.substring(8,10);

return Out;

}

else

{

return LCode;

}

}

Here is my Mapping screen

http://img260.imageshack.us/img260/7000/mapp1.jpg

Please help me

Regards

Former Member
0 Kudos

It is checking for the first value only and the rest it is doing suppress.

Please let me know how to check for all

Regards

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

pass Delivery No,Location code as argument to UDF,suppose you gine the argument name LCode

if (!Character.isDigit(str.charAt(LCode))&&!LCode.matches("[
p[
-]]*"))

//this logic for to check numberic value and Alphanumberic

{

int OutPut= LCode+use substing function for 3 didgits.

}

then return OutPut else

OutPut = LCode.

Raj

Former Member
0 Kudos

Hi Raja,

Iam very Poor at UDF's. what i want for UDF is

i will pass Location code as input and there inside the UDF we shld check for only is each and every character is Apha then return true else false.

Please provide suitable UDF for this

Regards

Former Member
0 Kudos

Hey

You can use the code given in the below link

Thanks

Aamir

Former Member
0 Kudos

Hi Aamir,

This code is to check the Is Numeric or not, but i want to check is it is Completely Alpha or not

Please assist me with UDF

Regards

Former Member
0 Kudos

Hi,

I want to check the incoming value is Is Alpha or not.

Please assist me with code for this

Regards

Vamsi

Former Member
0 Kudos

Hi All,

Please help me on this

rajasekhar_reddy14
Active Contributor
0 Kudos

Use regular expresion to validate the filed. this is the logic to check the filed to numberic or not.

if (!Character.isDigit(str.charAt(field)))

add this code to UDF

Former Member
0 Kudos

Hi raja,

Sorry, I didnt get you. Could you please post the entire UDF for this please

I want to check if the value is Completely Apha or not, iam least bother abt Numeric

Regards

Edited by: Vamsi Krishna on Oct 1, 2009 6:40 PM