Alpha Video Training
Results 1 to 4 of 4

Thread: functions

  1. #1
    Member
    Real Name
    Mark Liermann
    Join Date
    Jun 2000
    Location
    Wisconsin
    Posts
    141

    Default functions

    Not sure what I am doing wrong:

    I am running a report on an ODBC linked database. One of the fields, (Ap_Dist_Date) is a numeric date field in the form YYYYMMDD.

    The following formula works in converting the numeric number to a date field:

    ctod(substr(alltrim(str(Ap_Dist_Date)),5,2)+"/"+right(alltrim(str(Ap_Dist_Date)),2)+"/"+left(alltrim(str(Ap_Dist_Date)),4))

    However, If I try to place this formula in a function, it does not return a value. Anyone have any ideas.

    The field formula would be NDate(Ap_Dist_Date)

    FUNCTION NDate AS D (numeric_date AS N)
    ctod(substr(alltrim(str(numeric_date)),5,2)+"/"+right(alltrim(str(numeric_date)),2)+"/"+left(alltrim(str(numeric_date)),4))
    END FUNCTION


    Now, some may wonder why I am doing this, but nota ll databases are layed out in the YYYYMMDD and I was going to write a function, with case statements to distinguish them and convert automatically.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: functions

    FUNCTION NDate AS D (numeric_date AS N)
    NDate = ctod(substr(alltrim(str(numeric_date)),5,2)+"/"+right(alltrim(str(numeric_date)),2)+"/"+left(alltrim(str(numeric_date)),4))
    END FUNCTION

  3. #3
    Member
    Real Name
    Mark Liermann
    Join Date
    Jun 2000
    Location
    Wisconsin
    Posts
    141

    Default RE: functions

    Derrrrr,

    Ok, I am stupid.

    I guess I assumed (yes I know, bad thing) that the result is automatically assigned to the variable defined in the function call.

    Thanks!

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: functions

    Just one of those things. The only reason I know is that I made the same assumption at one time myself.

Similar Threads

  1. Functions
    By dik_coleman in forum Alpha Five Version 5
    Replies: 7
    Last Post: 11-26-2003, 07:08 AM
  2. Functions
    By davej in forum Alpha Five Version 5
    Replies: 3
    Last Post: 07-23-2002, 04:55 PM
  3. Functions
    By tlyon in forum Alpha Five Version 4
    Replies: 9
    Last Post: 02-28-2002, 06:00 AM
  4. Functions within Functions?!
    By Nathan White in forum Alpha Five Version 4
    Replies: 2
    Last Post: 10-23-2001, 03:59 PM
  5. key functions
    By JAMES GRIFFIN in forum Alpha Five Version 4
    Replies: 12
    Last Post: 07-24-2001, 05:12 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
  •