Jump to content
Server Maintenance This Week. ×

Emailing a Report not working


Pat

This topic is 3821 days old. Please don't post here. Open a new topic instead.

Recommended Posts

After reading previous posts, I thought I had the answer, but apparently not. I am trying to email a report, and I keep getting the 800 error, cannot save to this disc. Here is my situation in the script:

 

Find Records

Go to Layout 'Report'

Sort Records

Set Variable [$FilePath; Value: Get ( FilePath )]

Set Variable [$FileName; Value "Your Report"]

Save Records as PDF [Restore; No dialog; "$FileName"; Records being browsed]

Send Mail [send vis E-mail client; No dialog; to: "[email protected]"; Subject: "Your Report from " & Table::RequestByName; Message: "This is your report."; "$FileName]

 

 

At the Save Records point is where I get the 800 error. For specify output file I had: filemac:$FilePath/$Filename

 

What am I not doing correctly?

 

Thanks for the help.

Link to comment
Share on other sites

Get ( FilePath ) returns the path to your solution file. You cannot use it the way you are trying to, because it's not a path to a folder. If you are trying to export to the same folder where your solution is, you can use a simple relative path:

 

file:$Filename

Link to comment
Share on other sites

May I suggest that you use Get (TemporaryPath). This directory empties when the session ends, so you do not accumulate PDFs.

 

Set Variable [$FileName; Value "Your Report.pdf"]

Set Variable [$FilePath; Value: Get ( TemporaryPath ) & $FileName]
 

Link to comment
Share on other sites

I have just now noticed that your file name is a constant. In such case you do not need to put in a variable - it doesn't accomplish anything. You can simply specify:

 

file:YourReport.pdf

 

as the output file.

 

 

 

Or, if you prefer to go with Barbara's suggestion (I would), do:

 

Set Variable [$FilePath; Value: Get ( TemporaryPath ) ]

 

then specify:

 

filemac:$FilePath/YourReport.pdf

 

as the output file.

Link to comment
Share on other sites

I think the suggestion by Michael (Comment) is a good one but doesn't Get( temporaryPath) end with a "/" character? 

 

So - doesn't that end up looking like this:

 

filemac:/Macintosh HD/private/var/folders/_7/gytx2gzd617dk2qbxmynj6fw0000gn/T/S10//YourReport.pdf

 

Also, for debugging purposes, my preference would be to do something like this:

 

Set variable [ $fullpath; "filemac:" &  get( temporaryPath) & "YourReport.pdf" ]

 

Then just set the export step to use the variable $fullpath.

 

Also, if Pat had used this method, he (?) could have used the script debugger and variable watcher to see why his original get( Filepath) method didn't work.

 

He would have been able to see that it look something like like "file:/Macintosh HD/Users/Pat/Documents/Some Folder/Myfilename.fmp12/Report.pdf"

Link to comment
Share on other sites

 but doesn't Get( temporaryPath) end with a "/" character? 

 

Yes, it does - and I used to remove it until I found out it made no difference.

 

I prefer to do the final concatenation in the "Specify File" dialog - but it's a minute detail and mostly a matter of personal preference. In this case I would probably go with your suggestion because the same full path is required twice - once for saving the file and once for attaching it.

Link to comment
Share on other sites

This topic is 3821 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.