Simple Query Through Store & Forward

How would I go about sending a simple insert command (or list of insert commands) through the Ignition S&F system in the Module SDK? I’m looking for something like the IA Labs “runSFPrepUpdate” Jython call.

That call is implemented via HistoryManager::storeHistory, which you can get to from the GatewayContext.

More info: that method expects a datasource name and a HistoricalData object.

The simple implementation used by the scripting function looks like this:

    public static class QuerySFData implements DatasourceData {

        private static final long serialVersionUID = 1L;

        String query;
        String datasource;
        Object[] values;

        public QuerySFData(String query, String datasource) {
            this(query, null, datasource);
        }

        public QuerySFData(String query, Object[] values, String datasource) {
            this.query = query;
            this.values = values;
            this.datasource = datasource;
        }

        @Override
        public int getDataCount() {
            return 1;
        }

        @Override
        public HistoryFlavor getFlavor() {
            return DatasourceData.FLAVOR;
        }

        @Override
        public String getLoggerName() {
            return "Client Store & Forward";
        }

        @Override
        public String getSignature() {
            return "Scripted SF Query";
        }

        @Override
        public void storeToConnection(SRConnection conn) throws Exception {
            if (values != null) {
                conn.runPrepUpdate(query, values);
            } else {
                conn.runUpdateQuery(query);
            }
        }

    }

Awesome thanks!