Alpha Video Training
Results 1 to 7 of 7

Thread: pdf file names

  1. #1
    Ken Shaver
    Guest

    Default pdf file names

    Using action scripting to archive a report layout to a pdf file generates a file with a filename that is a combination of the name of the report form and a time and date stamp. For example: Analysis Rpt - PLM (02-02-05 02-04 PM).

    Is there a way to substitute or incorporate a field value in the filename? For example, for a report filtered on a field called JobNumber, where Jobnumber = 108095, the filename should be: JobNumber 108095, or even better: JobNumber 108095 (02-02-05 02-04 PM).

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: pdf file names

    You can convert the action scripting to xbasic and modify it to do what you want.

    Consider this snippet I converted

    'Save a report, label, letter, form or browse to an Acrobat, Rich Text, HTML or Plain Text file. You can specify which records to save.
    query.filter = ""
    query.order = ""
    :Report.SaveAs("Locations","PDF",query.filter,query.order,"test.pdf",.T.)

    If your report was named "Jobs" and the jobnumber object name on your form was jobnumber and you are printing the current record, you would modify the line like

    :Report.SaveAs("Jobs","PDF",query.filter,query.order,"Jobnumber "+jobnumber.text+" "+time("(dd-MM-yy 0h-0m am)")+".pdf",.T.)

  3. #3
    Member
    Real Name
    Jeffrey Walter
    Join Date
    Sep 2006
    Posts
    304

    Default Re: pdf file names

    Quote Originally Posted by Stan Mathews View Post
    You can convert the action scripting to xbasic and modify it to do what you want.

    Consider this snippet I converted

    'Save a report, label, letter, form or browse to an Acrobat, Rich Text, HTML or Plain Text file. You can specify which records to save.
    query.filter = ""
    query.order = ""
    :Report.SaveAs("Locations","PDF",query.filter,query.order,"test.pdf",.T.)

    If your report was named "Jobs" and the jobnumber object name on your form was jobnumber and you are printing the current record, you would modify the line like

    :Report.SaveAs("Jobs","PDF",query.filter,query.order,"Jobnumber "+jobnumber.text+" "+time("(dd-MM-yy 0h-0m am)")+".pdf",.T.)

    If I wanted to send the file to a certain folder would I have to use the entire path or could I just use a relative pathname?

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: pdf file names

    Quote Originally Posted by Jeff@Listbrokers View Post
    If I wanted to send the file to a certain folder would I have to use the entire path or could I just use a relative pathname?
    I don't know much about relative paths unless you mean in the sense that if the folder is under the database directory you could use

    a5.get_path()+chr(92)+"somedirectory+chr(92)+"somefilename.pdf"

  5. #5
    Member
    Real Name
    Jeffrey Walter
    Join Date
    Sep 2006
    Posts
    304

    Default Re: pdf file names

    Quote Originally Posted by Stan Mathews View Post
    I don't know much about relative paths unless you mean in the sense that if the folder is under the database directory you could use

    a5.get_path()+chr(92)+"somedirectory+chr(92)+"somefilename.pdf"

    That's essentially like using "C:\alpha5\somedirectory\myfile.pdf" right?
    That'll probably work. I was just wondering if you could just use "...\somedirectory\myfile.pdf"

    Just trying to be lazy. :)

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: pdf file names

    [QUOTE=Jeff@Listbrokers;400434]That's essentially like using "C:\alpha5\somedirectory\myfile.pdf" right?
    QUOTE]

    But portable on any machine regardless of where in the directory structure the database resides.

  7. #7
    Member
    Real Name
    Jeffrey Walter
    Join Date
    Sep 2006
    Posts
    304

    Default Re: pdf file names

    gotcha'. Thanks for that info. :)

Similar Threads

  1. File Extension names
    By C D Croscutt in forum Alpha Five Version 5
    Replies: 5
    Last Post: 04-30-2004, 09:31 AM
  2. application file names
    By kim Mitchell in forum Alpha Five Versions 2 and 3
    Replies: 2
    Last Post: 09-27-2003, 07:54 PM
  3. File Names and Extensions
    By kgilroy in forum Alpha Five Version 5
    Replies: 2
    Last Post: 12-30-2002, 04:34 AM
  4. File names
    By russ Boehle in forum Alpha Five Version 5
    Replies: 4
    Last Post: 10-30-2002, 03:33 PM
  5. Trunkated ~ DOS file names?
    By Jeff Moses in forum Alpha Five Version 4
    Replies: 2
    Last Post: 05-17-2000, 08:49 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
  •