Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Calender in Parameter with String field 1

Status
Not open for further replies.

locoproko

IS-IT--Management
Oct 3, 2007
4
US
Hello, First time here. I am Using Pervasive with a date field as string type. Data in string field is consistant yyyymmdd.

I can convert to mm/dd/yyyy for report no problem with following...

local stringvar cvdtin := {TIME_ATTENDANCE.DATE_IN};
local stringvar a := left(cvdtin, 4);
local stringvar b := cvdtin[5 to 6];
local stringvar c := cvdtin[7 to 8];
local datevar cvdin := date(tonumber(a),
tonumber(b), tonumber(c));

I wish to retrieve a date range and have made start date and end date a prompted parameter.

{TIME_ATTENDANCE.DAT{?edate}E_IN} in {?sdate} to


When promted I have to enter yyyymmdd format and wish to change parameter date in value type to "date" so I can use calender. I know I need to convert mm/dd/yyyy from calender output into yyyymmdd and pass parameter to sql statement but do not know how.

It brings me to formula editor and says it requires a string.

Thanks for any kick in the right direction!

Systems/IT Manager
Crystal Report Ver. 10.0.0.533
Pervasive 8.5 ODBC
 
Create you parameter as type Date with a range.

Create a formula to convert your string date field to a Date type date field:
// formula {@AttendDate}
Date(ToNumber(Left({table.StringDate},4)),ToNumber(Mid({table.StringDate},5,2)),ToNumber(Right({table.stringdate},2)))

In your record select formula:
{@AttendDate} = {?DateParameter}

MrBill
 
Thanks MrBill!!

After a couple of tries I got it to work. Hopefully I learn something from it.



Systems/IT Manager
Crystal Report Ver. 10.0.0.533
Pervasive 8.5 ODBC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top