Alpha Video Training
Results 1 to 12 of 12

Thread: Printing just the results of a search

  1. #1
    Andy Gill
    Guest

    Default Printing just the results of a search

    I would like to print just the results of a search with a press of a button. do i need to make a report? if so what's the next step?

    Andy.

  2. #2
    Member Jesse Sanders's Avatar
    Real Name
    Jesse Sanders
    Join Date
    Jul 2000
    Location
    Lancaster PA
    Posts
    107

    Default RE: Printing just the results of a search

    Andy,
    There are a couple of options depending if you print one or multiple records.
    If you want to print one record of a search you could create a calculated field in the grid like this:
    print = "Search_Field =" + Quote(Search_Field)
    Then create a field using your print varialble.
    The field control is Link
    The Display could static text like "Click to Print"
    The Link address would be "calculated from field"
    and the calculation would be like this:
    My_Print_Form.a5w?session.print_What = {Print} (Your calculated field)
    My_Print_Form is all alpha 5 code and looks like this:
    "%a5
    if Eval_Valid("session.print_What")
    dim filter as c
    dim order as c
    Dim temp as c
    Temp = strtran(session.Print_What,"=","")
    filter = Temp
    Order = ""
    dim filename as C
    Filename = session.session_folder + chr(92) + "results.pdf"
    Dim filename as c
    filename = report.saveas("My_Report@[PathAlias.ADB_Path]\Reporting.set","pdf",filter,order,filename,.f.)
    if file.exists(filename)
    response.redirect(session.session_url + "Results.pdf?" + time("hms3"))
    end if
    end
    else
    %"

    "head"
    "title"Soil Report"/title"
    "/head"
    "body"
    "p"Huston we have a problem!"/p"
    "/body"
    "%A5
    end if
    %"
    This is a lot to digest but follow up as you need to.
    Jesse

  3. #3
    Andy Gill
    Guest

    Default RE: Printing just the results of a search

    Thanks Jesse.

  4. #4
    Member
    Real Name
    Scott Levine
    Join Date
    Mar 2005
    Posts
    27

    Default RE: Printing just the results of a search

    I am trying to use this code but I just get a screen with the code in it when I click my print field.

    My calculated field is called print.

    Any ideas as to why this is not working?

  5. #5
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,680

    Default RE: Printing just the results of a search

    As the above code is just that (source code), you'll need to switch to the Source tab of the HTML Editor to enter it. If you enter it in WYSIWYG mode, it will be displayed as-is.

    -Lenny

  6. #6
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,827

    Default RE: Printing just the results of a search

    Jesse;

    I could not figure out how to use the strtrans() statement you had; it kept giving me a bad filter expression. I finally got it working by a slightly different tact. By starting out with a BLANK cacluated field and a different forumula for the link, the filter that comes over from the grid is whole and does not need trasformation.


    1) Create a calc field vPrintRec in your grid named equal to blank, e.g.: vPrintRec = ""

    2) Add this field to the grid with static text "Print Record", and computed with link address of:

    print_record.a5w?session.print_what=Job_no='{Job_No}'

    3) create an A5W page named print_record.a5w with the following entered in to Source. You will need to change the values for JobList (the A5 report) and Tracking.dbf below to match your needs:

    "%a5
    if Eval_Valid("session.print_what")
    dim filter as c
    dim order as c
    Dim temp as c
    filter = session.print_what
    Order = ""
    dim filename as C
    Filename = session.session_folder + chr(92) + "results.pdf"
    Dim filename as c
    filename = report.saveas("JobList@[PathAlias.ADB_Path]\tracking.dbf","pdf",filter,order,filename,.f.)
    if file.exists(filename)
    response.redirect(session.session_url + "results.pdf?" + time("hms3"))
    end if
    end
    else
    %"

    "head"
    "title"Soil Report"/title"
    "/head"
    "body"
    "p"Huston we have a problem!"/p"
    "/body"
    "%A5
    end if
    %"

  7. #7
    Member
    Real Name
    Steve Bovino
    Join Date
    Nov 2004
    Location
    Buffalo, NY
    Posts
    339

    Default

    Steve:

    I am attemping to print a record using your method. WHen I click to print I get to the report page but nothing happens. Apparently, the session.print_what variable is there. I have never used linking before. THis is what shows up in my browser window for the address:

    http://localhost/print_report.a5w?se...Fnum%3D%275%27

    This is what is noted in the grid for the calculated field.

    session.print_what = Control_num = '{control_num}'

    Any insight here would be appreciated.

  8. #8
    Member
    Real Name
    Steve Bovino
    Join Date
    Nov 2004
    Location
    Buffalo, NY
    Posts
    339

    Default

    Steve:

    Figured it out. My control_num is a numeric. Once I removed the single quotes - it worked just great. Thanks Steve.

  9. #9
    "Certified" Alphaholic Rich Hartnett's Avatar
    Real Name
    Richard Hartnett
    Join Date
    Nov 2002
    Location
    Bowie, MD
    Posts
    1,456

    Default Re: Printing just the results of a search

    Steve & Steve, I can get this to work just fine for a single return, but what about times when the search results in multiple records?

  10. #10
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    988

    Default Re: Printing just the results of a search

    Hi,

    Did anyone ever get this to work with multiple records?

    Denis

  11. #11
    "Certified" Alphaholic Rich Hartnett's Avatar
    Real Name
    Richard Hartnett
    Join Date
    Nov 2002
    Location
    Bowie, MD
    Posts
    1,456

    Default Re: Printing just the results of a search

    Yes I did get it to work with multiple records Denis, but only with a dialog component for entering the search criteria.

  12. #12
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    988

    Default Re: Printing just the results of a search

    Rich,

    Great!

    Any chance posting the code, i'd love to see it and manipulate it for my application.

    Denis

Similar Threads

  1. Posting Search results to HTML Title?
    By seidel1 in forum Web Application Server v6
    Replies: 4
    Last Post: 08-07-2004, 06:28 AM
  2. search returning incorrect results
    By Cheryl Lemire in forum Alpha Five Version 5
    Replies: 5
    Last Post: 08-04-2004, 07:34 AM
  3. Results of a Find by Key
    By David Montalbano in forum Alpha Five Version 5
    Replies: 2
    Last Post: 04-28-2004, 08:12 AM
  4. Search on Key gives wrong results
    By Jim Gatton in forum Alpha Five Version 5
    Replies: 2
    Last Post: 03-15-2004, 05:33 AM
  5. Search on Index - Search Key PopUp Dialog Bog
    By Jeff Wells in forum Alpha Five Version 5
    Replies: 1
    Last Post: 02-06-2003, 10:18 AM

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
  •