Skip to Content
avatar image
Former Member

Date Parameter

Hi

Appointment Dates in our DB are saved as Numbers. I used the following to convert them to date format in a custom function called @Appt date.

Function (numberVar v2)

local stringvar str;

str:=totext(v2,0,"");

local stringvar dd:=right(str,2);

local stringvar mm:=mid(str,5,2);

local stringvar yy:=left(str,4);

date(tonumber(yy),tonumber(mm),tonumber(dd));

If the date in the database is 20100406 it will appear on my report as 04/06/2010.

My record selection criteria is @Appt Date in {?Begin Date} to {?End Date} . However, Im having some trouble creating a Parameter for Appt Dates as it asks for dates to be entered in the YYYY-MM-DD format.

How can I create a parameter that would help me achieve the above statement.

Any help is greatly appreciated.

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Apr 07, 2010 at 08:48 AM

    The parameter display depends on the current viewing locale (Menu "View, Submenu "Preferred Viewing Locale"). This shouldn't influence any formulas.

    You are using a range "constructor" in a place where you want to test if the date is inside the range. Maybe thats the problem.

    I tested this and it works in my environment:

    local numbervar input := 20100406;
    local stringvar str :=totext(input,0,"");
    local stringvar dd:=right(str,2);
    local stringvar mm:=mid(str,5,2);
    local stringvar yy:=left(str,4);
    local datevar range daterange := {?start} to {?end};
    
    local datevar converted := date(tonumber(yy),tonumber(mm),tonumber(dd));
    
    if (converted in daterange) then "It's in the range" else "No, it's not in the range"

    Add comment
    10|10000 characters needed characters exceeded