Alpha Video Training
Results 1 to 4 of 4

Thread: Report by Date Range

  1. #1
    Member eboughey1's Avatar
    Real Name
    Elena Boughey
    Join Date
    Sep 2008
    Location
    Deltona, FL
    Posts
    166

    Default Report by Date Range

    I've created a report that you can choose either All data in a date range ordered by date range/client job # or Selected customers in a date range ordered by date range/client job #. When they choose the order of the report (drop date or client job #), it selects the actual report to use.

    I've gotten most of the report up and working but the date range for my report will only pull for the selected customer even though I have 'ALL' selected.

    Here is the code and a print screen of the dialog report. My eyes are about crossed trying to see the obvious error in my coding. Any help is much appreciated!

    Activate

    dim reports as c
    reports = <<%text%
    Date Range|Schedule Date Range@[PathAlias.ADB_Path]\workorder set.set
    Client Job #|Schedule-jobno@[PathAlias.ADB_Path]\workorder set.set
    %text%


    After Validate

    StartDate = alltrim(CurrentForm.Controls.From)
    EndDate = alltrim(CurrentForm.Controls.To)
    ClientName = alltrim(CurrentForm.Controls.Name)
    reports = alltrim(CurrentForm.Controls.ordertype)

    if alltrim(currentform.controls.Client) = "2" then and alltrim(CurrentForm.Controls.ordertype) = "Date Range"

    IF eval_valid("ClientName") = .f. .or. eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
    goto skipreport
    end if
    dim filter as c
    dim order as c
    Filter = "(Client = \""+ClientName+"\" ) .and. (Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
    Order = "cdate(Dropdate)+Truckcharg+str(Newjobno,19,5)"
    Dim filename as c
    filename = session.session_folder + "tempreport.pdf"
    filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
    if file.exists(filename)
    currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
    end if
    else

    if alltrim(currentform.controls.Client) = "2" then and alltrim(CurrentForm.Controls.ordertype) = "Client Job #"
    IF eval_valid("ClientName") = .f. .or. eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
    goto skipreport
    end if
    dim filter as c
    dim order as c
    Filter = "(Client = \""+ClientName+"\" ) .and. (Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
    Order = "Clientjobn"
    Dim filename as c
    filename = session.session_folder + "tempreport.pdf"
    filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
    if file.exists(filename)
    currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
    end if
    else

    if alltrim(currentform.controls.Client) = "1" then and alltrim(CurrentForm.Controls.ordertype) = "Client Job #"
    IF eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
    goto skipreport
    end if
    dim filter as c
    dim order as c
    Filter = "(Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
    Order = "Clientjobn"
    Dim filename as c
    filename = session.session_folder + "tempreport.pdf"
    filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
    if file.exists(filename)
    currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
    end if
    else
    if alltrim(currentform.controls.Client) = "1" then and alltrim(CurrentForm.Controls.ordertype) = "Date Range"

    IF eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
    goto skipreport
    end if
    dim filter as c
    dim order as c
    Filter = "(Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
    Order = "cdate(Dropdate)+Truckcharg+Clientjobn"
    Dim filename as c
    filename = session.session_folder + "tempreport.pdf"
    filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
    if file.exists(filename)
    currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
    end if
    end if
    end if
    end if
    Up and coming Alphaholic ;)

  2. #2
    Member eboughey1's Avatar
    Real Name
    Elena Boughey
    Join Date
    Sep 2008
    Location
    Deltona, FL
    Posts
    166

    Default Re: Report by Date Range

    Okay, instead of reading through the code, could someone answer a question?

    How would you clear the information for a variable in between else if statements? I added the code 'ClientName = "" in the area where client = '1' but it didn't work. My code is obviousy holding the 1st instance of a Client name and building the report from that.
    Last edited by eboughey1; 02-17-2009 at 09:53 AM.
    Up and coming Alphaholic ;)

  3. #3
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,595

    Default Re: Report by Date Range

    If this is your actual code, then you have errors in several places that look like this:

    if alltrim(currentform.controls.Client) = "2" then and alltrim(CurrentForm.Controls.ordertype) = "Date Range"

    should be

    if alltrim(currentform.controls.Client) = "2" .and. alltrim(CurrentForm.Controls.ordertype) = "Date Range"

    Pat

  4. #4
    Member eboughey1's Avatar
    Real Name
    Elena Boughey
    Join Date
    Sep 2008
    Location
    Deltona, FL
    Posts
    166

    Default Re: Report by Date Range

    That's what it was Pat.

    Once I changed it everything came together.

    If anyone wants to see the website the address is below. Go to the reports menu / Schedule by date range. I'm still fixing things on the website so any input is welcome too...

    http://www.mailtimenet.com

    user: alphauser
    pass: temp123
    Up and coming Alphaholic ;)

Similar Threads

  1. Filtering report by a date range
    By mmaisterrena in forum Application Server Version 8
    Replies: 1
    Last Post: 09-07-2007, 06:06 AM
  2. Report with prompt for date range
    By Dave Wilson in forum Alpha Five Version 6
    Replies: 6
    Last Post: 11-02-2005, 09:20 AM
  3. Date range in report
    By BWilliams in forum Alpha Five Version 6
    Replies: 11
    Last Post: 11-09-2004, 10:39 AM
  4. Date Range in Report
    By Jerry Gray in forum Alpha Five Version 6
    Replies: 4
    Last Post: 08-21-2004, 03:23 PM
  5. generating a report with a DATE RANGE
    By Elsie Beall in forum Alpha Five Version 4
    Replies: 8
    Last Post: 11-14-2001, 01:24 PM

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
  •