Alpha Video Training
Results 1 to 6 of 6

Thread: PDF file save by field name?

  1. #1
    Glenn Stehr
    Guest

    Default PDF file save by field name?

    I am a relative newcomer to Alpha and have very limited programming skills. I am wondering if anyone has a quick solution to this dilema.

    I want to be able to print/save a report to a PDF document but have the file saved as a combination of two fields from the current record.

    ie. I am in a form with a first name, last name displayed. I want to save the form (with current record only) as C:\"first name + last name".pdf
    Right now Alpha 5 defaults the filename to the form name and saves over it each time.

    If anyone can help I'd appreciate it greatly.

    Glenn Stehr

  2. #2
    Shahin Cassim
    Guest

    Default RE: PDF file save by field name?

    Hi Glenn,

    I suggest the following, use action scripting to do most of the coding, then convert it to inline Xbasic. I suggest that you rename each file using the function file.rename().

    This approach would probably be the easiet until you develop your skills.

    Make sure you have a current copy of the Xbasic reference available on Alpha's site (learning centre).

    Regards
    /Shahin

  3. #3
    Member
    Real Name
    Barry Rochford
    Join Date
    Apr 2000
    Posts
    452

    Default RE: PDF file save by field name?

    Do a search on PDF. I found many solutions:
    "Location of Saving the PDF's-2" 6-22-03 by
    my well educated friend Mr. Bill Hanigsberg.

    Gary Traub also has a short script in that same thread showing exactly how to use the Print.save_as() method.

    -Barry

  4. #4
    Glenn Stehr
    Guest

    Default RE: PDF file save by field name?

    Thanks,

    I have gotten 75% of the way there by looking at the examples posted. My one last hurdle is as follows:

    This is the adaptation I have contructed that works minus one feature I need.

    record_number = current_record_number()
    query.filter = "recno() = " + record_number
    query.order = ""
    dim ch2 as n
    dim deltit2 as c
    dim code2 as n
    code2=UI_YES_NO
    deltit2="Create a PDF from this record?"
    ch2=ui_msg_box(deltit2,"",code2)
    if ch2=ui_no_selected then

    else if ch2=ui_yes_selected then
    dim datech as c
    datech="Info Report 1 "
    filenameGary=:Report.saveas("Info Report","pdf",query.filter,query.order,datech)
    end if

    What I need is to figure out how to turn the following line:
    datech="Info Report 1 "
    into
    datech="Info Report 1 "+"A FIELD VALUE FROM THE REPORT I AM PDFing THAT IS THE SURNAME OF THE CURRENT RECORD"
    The file would save as "Info Report 1 SURNAME" with surname changing for each report.

    Is this possible? I have tried numerous things from the xbasic manual and nothing works. Can anyone help me?

    Thanks in advance
    Glenn Stehr

  5. #5
    Shahin Cassim
    Guest

    Default RE: PDF file save by field name?

    Try

    filenameGary=:Report.saveas("Info Report","pdf",query.filter,query.order,var->datech,.F.)

    ensuring that the datech var holds the correct filename you want to use.

    /Shahin

  6. #6
    Shahin Cassim
    Guest

    Default RE: PDF file save by field name?

    Sorry Glen,

    I should have read this properly.

    check out: http://msgboard.alphasoftware.com/alphaphorum/read.php3?sortby=lastreply&direction=desc&num=11&id=12341&thread=12339

    I believe that all your questions will be answered there.

    Regards
    /Shahin

Similar Threads

  1. Report File Save as problem
    By Jason in forum Alpha Five Version 6
    Replies: 2
    Last Post: 03-29-2005, 05:20 AM
  2. Variable in Report Save File Name
    By JohnFabrega in forum Alpha Five Version 5
    Replies: 2
    Last Post: 11-08-2004, 12:18 PM
  3. 'Save Report to a File' not working.
    By Clay Knight in forum Alpha Five Version 5
    Replies: 5
    Last Post: 09-12-2003, 01:54 PM
  4. Printing to file or Save as Report
    By Richard Wheeler in forum Alpha Five Version 5
    Replies: 3
    Last Post: 12-22-2002, 07:31 PM
  5. Why won't this save to primary file?
    By Themis Skiathitis in forum Alpha Five Version 4
    Replies: 24
    Last Post: 10-18-2000, 10:09 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
  •