Expand my Community achievements bar.

Force Date "Display Pattern"??

Avatar

Former Community Member

Greetings,

We are having troubles with the "Display Pattern" of Date fields.  The scenario is that we receive data in XML, apply it to the form, and then want it displayed in a specific format on the Form, but it doesn't work like it should.

For example,

1. Our XML contains dates in the format MM/DD/YYYY (e.g. 05/11/2010).

2. We want it displayed as MMMM D, YYYY (e.g. May 11, 2010)

So we set the "Display Pattern" of the "Date" field in LiveCycle, to equal date{MMMM D, YYYY}

But when we receive the data in the MM/DD/YYYY format from the XML, it still gets displayed on the Form as MM/DD/YYYY.

If we re-select the date on the form itself, the correct pattern is displayed.  But we need these to be correct when the data is applied, and this doesn't seem to work.

Suggestions?  Something we're missing?

Thanks in advance!!

GS

1 Reply

Avatar

Level 10

The Date Control expects data in the format YYYYMMDD.. But your XML is sending the data in MM/DD/YYYY, so you need to convert the input data to the required format. Then only the Display pattern can work.

Put the below code in the Initialize event of the Date control..

Language: FormCalc

$.rawValue = Ltrim(Rtrim($.rawValue));

$.rawValue

= Num2Date(Date2Num($.rawValue,"M/D/YYYY"), "YYYYMMDD");

Thanks

Srini