on 09-27-2008 10:20 AM
Hi,
In the message mapping, idoc to structure,
idoc field of type CHAR, length 10.
possible values in this field are:
1003
PD01
both alphanumeric. Value will be always 4 characters max.
if it is numeric, ex:1003, it is showing with leading zeroes as,
0000001003. But i have to send only 1003, without leading zeroes.
if it is alphanumeric, no issue, it is always left justified & shows only PD01.
i tried to use arithmetic function, ROUND, this is ok for numeric values, but, data will be both. Even i can not use substring, bcoz, numeric value is right justified & alphanumeric is left justified.
If it has to solve by any UDF, plz share the code & the steps to fulfill the same with screen shot if possible.
tnx n rgds,
balu
Hi,
try with the below UDF
use cache parameter as value
//write your code here
String output = a.replaceAll("^0+","");
return output;
here a(idoc field) is the input to the udf.
idoc field -
>udf--->tgt field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
closed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
UDF: First check String length>4 then
For removing leading zeros
&FieldName(Z)&
or u can use also method suggested by malini after checking string length.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use a simple UDF. The UDF takes in 1 parameter and returns 1 parameter.
int intVal = Integer.parseInt(a);
return(intVal.toString());
Oops. This will work if the input is a number. But if string value is given it will error out.
Modify the above piece a bit.
String strResult ="";
try{
int intVal = Integer.parseInt(a);
strResult = intVal.toString();
} catch (Exception e)
{
strResult = a;
}
return (strResult);
Edited by: Jaishankar on Sep 27, 2008 2:59 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
9 | |
9 | |
8 | |
7 | |
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.