cancel
Showing results for 
Search instead for 
Did you mean: 

Date Field Transformation

Former Member
0 Kudos

Hi Group,

I have one date field node with format dd/mm/yyyyy,I need to check whethere this field is blank or not if it is blank I need to pass blank as it is and if the field is with

dd/mm/yyyy I need to transform into yyyymmdd,can any body give me suggestions

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi swabap,

1. first check your node is blank or not. this can be done by

boolean-><b>equals</b> function

equals function has two input parameters . give one as your souce node(date) and the other as a constant[]

2. now use the boolean-><b>if</b> function

give the output of <b>equals</b> as the input to <b>if</b>

3. the <b>if</b> has two options <b>then</b> and <b>else</b>

give a constant[] in the side of <b>then</b>(this will allow as to pass blank value if the date is blank)

at the side of <b>else</b> use the use the Date-><b>DateTrans</b>

double click on datetrans

give dd/mm/yyyy in the source format and yyyymmdd in the target format

4.connect the output of <b>if</b> to your target node

Kind Regards

Francis

Former Member
0 Kudos

Hi,

do below:

source field check with constant[] with equalS function.....take this to boolean if then else functio.........in then put constant[].......in else put source field -> dateTrans....in dateTrans specify yyyymmdd........take to output field

Thanks,

Rajeev Gupta

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>>>>field is blank or not if it is blank I need to pass blank

use exists function

>>>>I need to transform into yyyymmd

use DateTrans function (you can specify format as yours

in functions parameters)

from:

http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

Regards,

michal

Former Member
0 Kudos

Hi ,

When I am using this I am getting the blow error when I have blank in this field

<b>Unparseable date: ""</b>

Former Member
0 Kudos

do as michal said just add if else condition after exhist function. if does not exhist then use else part and send blank if exhist use the if part then use date transmission.

this works based on the assumption that alwayas you get any correct date or no field value. in other cases this is one will fail . you need to use UDF for other conditions to check.

Sreeram Reddy

Former Member
0 Kudos

Hi,

just take source field .....use MapWithDefault function.....then take it to equalS function.....double click MapWithDefault and enter nothing so it will be []....then do rest which i have above said.......then you will get your desired output....

Thanks,

Rajeev Gupta

henrique_pinto
Active Contributor
0 Kudos

The node may exist and still have blank value.

If the only possibilities for input are blank or dd/mm/yyyy formats, go as Gupta said. Just use a standard If function, and compares the input field with a blank String (using equalS function) or check if its length is zero (using equalsA function).

Regards,

Henrique.

Former Member
0 Kudos

Hi Michal,

the source date node may exist but it can have a blank value ....then your dateTrans function will give error.......

so its better to use MapWithDefault for a blank value [] and then send its output to equalS function as i have said above.........this will handle all the cases....

Thanks,

Rajeev Gupta