SQL within a client

I have a SQL statement that outputs results to a file. Where will the file attempt to be written? on the Client’s local machine, or the Gateway computer?

Snippet:
SELECT columns…
FROM table
INTO OUTFILE “C:\tmp\output.csv”

REF:

If you’re running it via a SQL command, it’s almost certainly going to dump into a file on whatever machine the database is running on.

1 Like

Yes, it is a large SQL stmt run via system.db.runquery(stmt) in an event handler for a button.

I’m really looking for a way to save it to the client machine. Since the save button for the easy chart does not work…I"m going to test where the file actually goes. So far it has landed on the client computer.

Is there any way to replicate the function of the Easy Chart’s Save button? It does not workfrom Ignition 7.9.8 and up.

Can you clarify what “does not work” means? There was a bug in 7.9.8 in particular that’s fixed in 7.9.9 and up, where exporting would result in an empty file.

“Does not work” means just that, I get an empty, corrupted excel file when using the built in save button, I have been attempting several methods of work arounds. Thought I would try to more fully address the issue first before continuing…in addition, I have tested 7.9.8 and higher. I have tested the respective versions and found none of them with a working save button.

And what version of Ignition are you using? Are there any errors in the client/designer logs? Can you upload one of the corrupted files here, or PM it to me?

I sent you an output file. There are no error messages in the logfile.

Not sure if this helps, but I just noticed the exported excel file has 9 columns and the related SQL table for that UDT has 14 columns.

FYI,

The select into outfile statement, even when being called via Ignition’s RunQuery command will consistently output the file on the physical machine local to the mySQL server instance.

Uhm, that’s by design. Of your database. Ignition has no way to impact that. It would be true of (the equivalent syntax in) SQL Server and Postgres and Oracle, too.

As to your OP, consider using the interfaces of JFreeChart to script access to the actual data in your EasyChart, and feed that to whatever Excel export tool you like. Python’s own csv module is quite configurable.

1 Like

Not sure what’s going on with the easy chart export. I’d get in touch with support, if you can - we’re exporting the column information to the file, so it’s just the data that’s missing, which is odd - I would have expected the file to be completely empty.