I was wondering if it's possible to use variables in the load script and either prompt the user for input, or pull the values from an object in the application like a date picker. The reason for this is that I'm using some SQL to pull three consecutive months worth of data from a database. I'm usually pulling for the last three months. I would like to be able to change which months are loaded without manually editing the load script each month.
This function can be used in the script only and opens an input box that prompts the user for a value during the script execution. The parameters cue and caption are used as message and caption texts, respectively. The function returns the entered value.
The input box function returns NULL if the dialog is cancelled, closed or cannot be shown.
Load Input('Enter value', 'Input box') as v, Recno () as r autogenerate 3;
There is no need to edit the script each month. The current date is always known, so you can calculate the start date of the data you need - it could be "three months back" or "the start of the month three months back", or whatever rule you can think of. Create a variable according to your rule at the beginning of the script and use it later in the script as a condition to filter the records.
I didn't use input in the script besides some basic testing, and don't remember the details. I'm thinking now that there could be (if not - should be!) an option for the unattended reload. Say, if there is no user input for some reasonable time, use something else defined in the script as a default value.