Posted by: IS | June 8, 2009

International date formats in Report Writer


You will need to create a modified version of the report you want in US date format.

In GP 10, run the report and click on ‘Modify’. Once the report layout opens in Reort Writer, click on the toolbox and select Calculated Fields. Click on New. Give the field a name (such as ‘Document Date US’) and set the Result Type to ‘String’. Ensure the Expression Type is ‘Calculated’.

Next, click the ‘Functions’ tab and select ‘User Defined’. In the ‘Core’ list box, select ‘System’…and then select ‘RW_DateToString’ and click ‘Add’.

Now select the Date Field you want to convert. For example in the Cheque report Layout, you may want to select ‘Document Date’. To do this, click on the ‘Fields’ tab. In the ‘Resources’ list select the table (in this case PM_Payment_Work),. And then in the ‘Fields’ list, select the Date field (In this case ‘Document Date’)…and click ‘Add’.

Now you need to define the date format. Click on the ‘Constants’ tab. In the ‘Type’ list select ‘String’. In the ‘Constant’ field type in the format you want – eg: MM/DD/YYYY…and click ‘Add’.

The expression you end up with shoud be similar to – FUNCTION SCRIPT(RW_DateToString PM_Payment_Work.Document Date “MM/DD/YYYY”)

Now, double click the date field on the report that you want to change, and make it invisible. (I never recommend deleting fields from a report – just make them invisible – in case there is another field dependent on it)…then drag the field you just created out on to the report and drop it over the field you just made invisible. Make any formatting changes required – text size/colour etc.

You will need to repeat this process for each seperte date field you want to alter the format for.

The format can be anything you want eg: MM-DD-YYYY, DD/MM/YY etc.


Responses

  1. Thanks much for providing such a detailed article.

    It has saved my lot of time.

    Thanks once again.

    • Hi Shabnam. Thanks for the comment. Let me know if you need any help.
      Best regards, Ian.

  2. Hi istewart. Can I use for transaction form ? So in the date’s field , for example : document date, I want to change the format into DD/MMMM/YY ?

    Thank you.

  3. […] DynamicsGP.ie blog: International date formats in Report Writer […]

  4. […] DynamicsGP.ie blog: International date formats in Report Writer […]

    • Great post – much more eloquent than mine!!


Leave a comment

Categories