Skip to Content
0
Former Member
Apr 09, 2010 at 09:56 PM

Date Parameter

13 Views

Hi,

I posted this issue once before and florianschneider and Carl Sopchak were kind enough to help me out but the issue has not been solved.

This is what the issue is

I have a custom function that takes a number and converts it to date format.

Name of the function is ApptDate

Function(Numbervar v2)

Local Strinvar str;

local stringvar 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));

In a formula the datefield is used to be converted to date.

ApptDate(Datefield) which is called @Appt_Date

I would like to use date parameters in the record selection criteria and say

@Appt_Date = {?Start Date} to {?End Date}

But it gives me an error. The following has been suggested but using Carl's method I get an error.

The following suggestion was provided by florianschneider

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"

The following suggestion was provided by Carl Sopchak to be able to use Parameters.

function myFunc (start as datetime, end as datetime) as string

and call the function using

myFunc({?Start Date}, {?End Date})

I tried Carls way but there seems to be problem with syntax. Any help will be greatly appreciated.

Thanks!