on 03-27-2007 3:25 PM
How can i do this?.
Do we have stanadard function?.
If data is numeric, what i need to do?.
If data is string, what i need to do?.
Rahul,
You cannot achieve this with standard functions. You have to go for User defined function.
Put this code in your UDF:
Name the function as <b>zerosuppress</b> and take the <b>cache as value</b> and take <b>one argument input</b>. Then put the code below:
//write your code here
String output = input.replaceFirst("^0+","");
return output;
This removes all the leading zeros.
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
U can do it using graphical mapping.
Use <b>abs </b>function from <b>arithmetic</b> group.
It works for both string and integer.
but use only for +ve numbers.
Thanks,
Maheshwari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
With the UDF we can also achieve ,plz try to see the below
Suppouse you received the format "000123" then you want 123.
1)One way is input Sting{} num
in UDF
int actval = Integer.parseInt(num.trim());
return actval;
OR
input num as string array list and try to maitain the logic to get the char which is not zero
String{} num.
String{} actval = "".
for(int i = 0 ; i < num.length ;i++){
if (! num(i).equals("0"))
actval = actval + num(i);
}
return actval;
I am sure first one will work.
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
try also,
Create a user defined funciton zerosuppress and take the cache as value and take one argument input. Then put the code below:
//write your code here
String output = input.replaceFirst("^0+","");
return output;
It will remove all your leading zeros. Let me know whether your issue is resolved or not?
Regrds
Chilla
HI,
see this can be possible wih standard functions
FormatNum
Converts I according to a pattern that you define using the function properties. The possible patterns are the same as in the
http://help.sap.com/saphelp_nw04s/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
And User defined functions also.
You can write auser defined function to achieve this
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
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.