There was a problem loading the comments.

Event Server File Trigger Example Passing Parameter From File Itself

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

We recently had an inquiry as to how to watch for a file, trigger a batch, AND pass a value from that file into a batch job. Sounds complicated, right? It's not too bad with all the tools available with Report Runner.

 

---

 

Here's the basic logic structure of the solution:

 

1. Create a 32-bit ODBC DSN to a text file source (it can also be CSV or delimited -- this example is a simple text file). This sample uses a text file with the words "This is the Value to Pass!!!" in it -- this is what gets passed to the parameter value)

2. Create a SQL-based Parameter Expression with new ODBC System DSN connection to the text file to fetch the value.

3. Create batch and assign new Parameter Expression to report parameter.

4. Watch for the file (use Event Server to set up the file watcher with File Rules).

 

That's it! Now, let's see how each step works...

 

---

 

1. Create a 32-bit ODBC DSN to a text file source (start 32-bit ODBC Manager, create a new connection, select a file based driver, name and describe it, choose the directory, and define the schema).

 

 

 

 

 

 

 

 

 

---

 

2. Create a SQL-based Parameter Expression with new ODBC System DSN connection to the text file to fetch the value.

 

 

 

 

---

 

3. Create batch and assign new Parameter Expression to report parameter (new batch using test "Batch Message" system report -- simple report to pass a parameter to, assign new expression to the parameter, set for Mail export, test the report in the job edit window, and set mail subject to file/parameter value using batch-specific INI setting -- jnParm1 is a "jn" variable that can be used most anywhere within app to pass value of parameter #1).

 

 

 

 

 

 

 

---

 

4. Watch for the file (use Event Server to set up the file watcher with File Rules).

 

 

 

---

 

Restart Event Server and See it work! (file is read and re-named as instructed and log file generated showing rule running).

 

 

 

---

 

Any questions? Just open a Support ticket via the Help Desk or email support [at] reportrunner.com! Show us your work and any related log file, and we're happy to help you through thinking through your solution.

 

---

 

Debugging information about this solution:

 

1. When the file triggered batch runs, it will create a separate JNRRB* log file for the run. If you don't know what log goes with the triggered batch, just find the batch XML file in the monthly XREF file in the log file directory. The monthly XREF logs all scheduled and triggered batches and the log that goes with it. 

 

2. Also in the log file directory, you will see a FILE sub-directory. This is the log directory for just the File Rules. It will show when a file is found and what batch is getting triggered. If your file rules are set to run each 5 minutes, you'll see a log generated each 5 minutes. These File Rule logs are only retained for 3 days (Batch logs are retained for 30 days).

 

 

 

 

 

 

 


Share via

Related Articles

© Report Runner Support