Send Report trough FTP

Hi, I have a client that wants to send pdf and csv reports by ftp, I tried this using the reporting module and it works fine. My client have Ignition version 7.7.7 and I realized that in that version, the reporting module doesn’t send report automatically through FTP. it is possible to use the new reporting module on the old version of Ignition? if not, can you help me with a solution to send report via ftp on Ignition 7.7.7?

No, it’s not possible to use a newer module with an older version of Ignition. They will need to upgrade unless you can find a way to do this through Jython.

I’m not sure what options are available to you in v7.7.7 for executing and saving reports (can’t find the manual online). But if you can get the reports saved you can run a python script, using ftplib, to upload the report to the FTP server. The script will have to run on the machine that the file is saved on (unless networked drive). Below is a modified ftp upload script I’ve used on one of my projects:

import ftplib

# Make sure to include double back slashes.  Should be a file path to a folder on the machine this script will run on.
filepath = "C:\\filepath\\goes\\here\\Report Filename.pdf"

# Check if report exists before trying to upload to FTP server.
file_exists = system.file.fileExists(filepath)
if (file_exists):
	# Connect and login to FTP site
	ftp = ftplib.FTP("ftp_url")
	ftp.login("ftp_username", "ftp_password")
	# Can use this to check you are connected (can comment out after debugging)
	print ftp.getwelcome()
	# Navigate to folder on the FTP site you want to save the file to.
	ftp_path = "/path/to/FTP/folder" # Notice the forward slashes
	ftp.cwd(ftp_path)
	# Can use this to check you are in the proper folder (can comment out after debugging)
	print str(ftp.pwd())
	# Save the file to the FTP site
	ftp.storbinary("STOR " + filename, open(filepath))
	# Quit the FTP session
	ftp.quit()

Hope that helps get things started!
-Will

2 Likes