FlexEcute works as an add-on to FlexQuery and also includes a ‘helper’ app to assist with scheduling.
In order for FlexEcute to integrate with FlexQuery the following is required:
- Obtain a license of FlexEcute
- Create Custom Views in FlexQuery and set export defaults
- Create a FlexEcute script
- Schedule the execution of the FlexEcute Script using any Windows compatible task scheduler
A group of custom views from My FlexQuery can be automated by launching FlexQuery with the Command Line Parameter A:<GroupName>. For example:
- C:\RIQ\FlexQuery\FlexQuery A:Automated_Daily_Sales_Report
- C:\RIQ\FlexQuery\FlexQuery A:”Automated Daily Sales Report” – use quotes around the GroupName if spaces are present
The output is defined in FlexQuery through the Custom View designer (the button on the right of the custom views) by clicking the Exports Defaults button. Note that the Exports Defaults button only shows if the FlexQuery Module License for FlexEcute exists:
Clicking the Export Defaults button displays the following dialogue which allows the configuration of the default export settings for the Custom View, including export type, location and file name/extension.
The FlexEcute ‘Helper’ app allows a scripted sequence of processes and runs as a standalone application. It can be scheduled using any scheduling software such as Windows Scheduler or Retail Pro’s scheduler. To schedule the execution of a script, simply use: C:\RIQ\FlexEcute\FlexEcute <Scriptname>. A script can also be loaded and executed from the main UI.
FlexEcute scripts accept the following key words:
- DIRECTORY – changes to the specified directory
- MAKEDIR – creates a directory
- COPYFILE – copies a file
- MOVEFILE – moves a file
- COPYDIR – copies an entire directory
- MOVEDIR – moves a directory
- WAIT – waits for a specified period of time, in seconds
- -END – signals the end of a script
- LOCK – places a file lock to be used in conjunction with CHECKLOCK. Testing for the existence of a lock file allows for the suspension/termination of execution of the script or a task.
- UNLOCK – Removes a lock file created with the LOCK command
- CHECKLOCK – Checks for the existence of a lock file
A basic example of a FlexEcute script can been seen in the screenshot above which creates a lock, changes to the directory where the Accounting Link is installed, launches the Accounting Link, on exit of the Accounting Link it launches Notepad, and on exit of Notepad the lock is removed.
To export two groups of views from FlexQuery, you could write a script like the following:
A more complex script, including the management of polling could include:
IF NOT PROCESSRUNNING AcctLink.Exe
Backup VOuchers=backup_vouchers.cmd archive
EXPORT VOUCHERS=ECMPROC -a -out
Backup VOuchers=backup_vouchers.cmd restore
Export Accounting Flags=AccFlagManager -export
Process In=MPROCIN /p WS:100
Import Accounting Flags=AccFlagManager -import
IMPORT VOUCHERS=ECMPROC -a -in
Process OUT=MPROCOUT /p WS:100
Build SRO Totals=SRO /SA:YESTERDAY /RC:MTD /OO:MTD WS:1
In the case of FlexQuery exports, as a file is saved on disk, it is then possible to act on that file through third party applications such as command line mailers, an FTP script etc. all of which can be appended to the FlexEcute script, or scheduled separately through another script.
We use FlexEcute extensively to schedule polling as it not only ensures that no ecmproc overlaps another, but also stores the duration of each operation. Checking the log gives you a much better idea of the length of the polling process.