cancel
Showing results for 
Search instead for 
Did you mean: 

How to display blank date ?

Former Member
0 Kudos

Hi all,

I am using web service model in a dynpro application. In the response of web service there is a date field. When blank response is returned, all fields (except date) are blank, however the date contains value '0002-11-30T08:00:00.000Z' ,when web service is tested in web service navigator.

When this is linked with dynpro context, and application is run, the actual value displayed in view is '11/30/0002'.

How can we display just blank instead of this absurd date ?

Thanks,

- Shankar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check the condition and set the date attribute accordingly

if(absurd date)

set the date attribute accordingly

Regards

Saravanan K

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Shankar,

When you are setting value from reponse web service to context attribute of date UI element set the date attribute to empty string like:

context.set<attribute-name>("");

Regards

Suresh

Former Member
0 Kudos

Thanks all for your help.

Saravanan, to add into your solution, I used the following

if (

wdcontext

.<CurrentContextElement>()

.get<DateAttribute>()

.getTime()

.getYear() == -1898 )

then ( assign null )

This is because in java.date format 1900 gets subtracted from year value. So in case of blank, '0002' is the year value received (as mentioned in my question).

Hence 2 - 1900 = -1898 is used.

Regards,

- Shankar.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Set the null to the attribute fo the Date

wdContext.current<node>Element().set<Date>(null);

Kind Regards

Mukesh