 1. ## 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.  Reply With Quote

2. ## 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  Reply With Quote

3. ## 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!  Reply With Quote

4. ## RE: functions

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

#### Posting Permissions

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