Alpha Video Training
Results 1 to 2 of 2

Thread: CTOD problem

  1. #1
    Member
    Real Name
    Robert McConnell
    Join Date
    Feb 2008
    Posts
    2

    Default CTOD problem

    For many years I've been using using Alpha 4 for routine report generation. Since 2008 it's been Version 8 on an XP machine. Recently, after not using it for about a year, I fired it up to enter some annual data and generate reports. Suddenly a problem not seen previously appeared with one of my calculated fields in a database. The problem is with the the CTOD function calculating a date field by combining a month/date character field with a fixed string to arrive at a date field.

    For example in the following, where the REF_DATE field is of type C:8 and has a value 1/4,

    CTOD(REF_DATE + "/6") correctly evaluates to 01/04/2006
    CTOD(REF_DATE + "/06") incorrectly evaluates 01/04/2000
    CTOD(REF_DATE + "/2006") incorrectly " 01/04/2002
    CTOD(REF_DATE + "/2012") incorrectly " 01/04/2002
    CTOD(REF_DATE + "/12") incorrectly " 01/04/2001
    CTOD(REF_DATE + "/13") incorrectly " 01/04/2001

    It appears that The single digit immediately following the '/' in the second string is always taken as the year after 2000. However,
    CTOD("1/4" + "/12") correctly evaluates to 01/04/2012
    CTOD("1/4" + "/2012") correctly evaluates to 01/04/2012

    as do all other examples I've tried in which the first character string is explicitly included rather than as a reference to a field.

    Is this a known problem, and if so is there a solution?

    Thanks,

    -rob

  2. #2
    Member
    Real Name
    Robert McConnell
    Join Date
    Feb 2008
    Posts
    2

    Default Re: CTOD problem

    Solution found! It turns out that the expression in the CTOD function had been copied from an early Alpha Four v2 database. With v8 I should have applied the RTRIM and LTRIM functions to the fields used as arguments to CTOD. Sorry about that.

    -rob

Similar Threads

  1. Between and CTOD() not working for me
    By MikeData in forum Alpha Five Version 10 - Desktop Applications
    Replies: 10
    Last Post: 04-11-2011, 09:18 AM
  2. CtoD() of particular Format
    By SMARTII in forum Alpha Five Version 9 - Desktop Applications
    Replies: 4
    Last Post: 08-20-2010, 02:14 PM
  3. ctod()
    By G Gabriel in forum Alpha Five Version 8
    Replies: 5
    Last Post: 04-03-2007, 09:36 PM
  4. CTOD (What am I doing wrong??)
    By Rich Hartnett in forum Alpha Five Version 7
    Replies: 14
    Last Post: 02-13-2007, 12:39 PM
  5. Problem with CTOD
    By Jeff Kerman in forum Alpha Four Version 6 and Prior
    Replies: 4
    Last Post: 08-17-2000, 07:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •