Options

Formatting dates in reports

triona*triona* Member Posts: 27
Hi folks,

Im trying to figure out how to display all dates in certain reports ( just reports relating to our Irish site) in the following format dd-mmm-yy...but im new to navision and haven't a clue. I found a post saying to use something like the following:

textVariable := format(datefield,10,'<day,3>/<month,2>/<year>');

..problem is i don't even know where to type that!!

Can anyone give me the idiot proof answer to this question??

Thanks y'all,

triona*

Comments

  • Options
    Dean_AxonDean_Axon Member Posts: 193
    Hi Triona,

    There are some standard ways of formatting the the date field. I would recommend searching the c/side reference guide with the key word "FORMAT".

    This gives a very good explanation of how to use the format command for different data types including the DATE.

    As for where to type it.....

    Depends on how you want to use it ???? there are many options.

    Hope that points you in the right direction. :D

    Dean.
    Remember: Keep it simple
  • Options
    triona*triona* Member Posts: 27
    thanks for the reply Dean!

    im gonna take a look at that reference guide now....

    what i was trying to figure out is, for a particular text box on say, the Sales Invoice report..when i go into the properties of the text box, can i type something directly into the Format field to change the date format just for that text box...dont want to change the format of the date field in the actual table where the date is stored....hope that makes some kind of sense :roll:

    triona*
  • Options
    Dean_AxonDean_Axon Member Posts: 193
    Hi Triona,

    Yep, makes perfect sense, done this with customers before :D

    Lets use an example where the "location Code" on the sales header is used to define the Date format.

    Lets assume there are 2 Location Codes
    DMY (Day Month Year)
    YMD (Year Month Day)

    Create a new text variable:

    MyNewText Type=Text Length =250

    so your code would be something like:
    OnPreSection()
    -----------------
    if "Location Code"=YMD then
      MyNewText:=Format("DateField",3)
    else 
      MyNewText:=Format("DateField",0);
    

    From the help file you will see that format 3 changes the date layout to be YMD(Year Month Date) and format 0 is the default date layout.

    The way in which I would deal with this for my customers would be to create a new field on the Customer Card that specifies the format to be used. You can then get this each time you create a new sales order and transfer it at that point.

    Dean
    Remember: Keep it simple
  • Options
    RobertMoRobertMo Member Posts: 484
    Here’s idiot proof answer:

    Open report in designer. Chose menu View / Sections. Select a field where your date is shown. Open properties window for this filed and enter following in Format property:
    <Day,2>-<Month Text,3>-<Year,2>
    
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • Options
    triona*triona* Member Posts: 27
    perfect! thanks for all the replies

    triona*
Sign In or Register to comment.