on 07-13-2009 1:45 PM
Hi,
Can someone help me out please with a UDF that gets an input string, but it needs to look at that string as if it is a date, and then transform that string to another format.
The input string can be empty or contain 8 zeroes ("" or "00000000") and if that happens the UDF must return "", and of course no transformation can be done then.
If the string is not empty or zeroes, the transformation will be yyyymmdd to dd-mm-yyyy.
Kind regards
Robert
Hi, I knew about the possibility of a full graphical mapping but asked explicitly for a UDF for esthetical reasons.
I managed it with some held from other sources with the following code:
String result;
if (a.startsWith("0") || a.length() != 😎 {
result = "";
} else {
result = a.substring(6)"."a.substring(4,6)"."a.substring(0,4);
}
return result;
Thx anyway for replying
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use the mapping as below
date(source field)---->equalS--->or-->ifWithoutelse---->UDF----date(target field)
constant[]/ |
date(source field)---->equalS/
constant[00000000]/
u will find the sample java code to convert from one date format to another date format search online and write it as UDF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
YOu can make use of the date function (dateTrans)Transformdate with input format as yyyymmdd and output format as dd-mm-yyyy.
Path : double click on the mapping editor area.
All functions->Date Functions->Datetrans
Regards,
ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> Hi,
>
>
> Can someone help me out please with a UDF that gets an input string, but it needs to look at that string as if it is a date, and then transform that string to another format.
> The input string can be empty or contain 8 zeroes ("" or "00000000") and if that happens the UDF must return "", and of course no transformation can be done then.
>
> If the string is not empty or zeroes, the transformation will be yyyymmdd to dd-mm-yyyy.
>
>
> Kind regards
> Robert
you can utilize the standard date function - datetrans
for your check on if it a zero or empty string you can utilize the standard string function equalsS along with the boolean if else function
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
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.