CatBase Scripts
We can create scripts to do any kind of special processing you need.
Please contact us for more information on custom scripts! If it's not too complicated and we feel other CatBase users might find it useful, we'll create it for free. If it is more complicated, there may be a charge for creating it. Tell us what you need!
Scripts can run:
-
When data is imported
-
When a field is modified
-
When a record is saved
-
When Data is published
-
Manually at any time
The Script Dialog
When you add or modify a script, you will see the Script Dialog:
Click Import a Script, then locate the script you want to use.
After a script has been selected, it will be shown in the Script to run area:
Do not try to modify a script! This will cause errors. Please contact us if you want a script modified.
Run a script when data is imported
When you are importing data into CatBase, you can choose a script to run as each record is imported or after the whole import has completed. To set this up, go to the Preferences tab on an Import Style, where you'll see the Script options:
Run a Script before importing
Choose this option when you want the script to run before the data is imported - for example, perhaps to clear all the data from a certain field before re-populating it with the imported data (product prices, perhaps).
Run a Script after each record is imported
Choose this option if you want the script to be executed as each new or updated record is saved.
Run a script after all records have been imported
Choose this option if you want a script to execute at the end of the data import. This is handy for times when, for example, you want to do some cumulative processing or updating of related records.
Some scripts require some user-specified data - for example, a script may need to know the location of a folder that you want to copy images from or to, or it may need to know the tax rate to use in calculations. You can either type the information into the Script data area or click on the Select a folder button to choose a folder location.
Run a Script when a field is modified
There are lots of options you can set for individual fields in the Field Properties dialogue, but if you need something special to happen when a particular field is modified you can tell CatBase to run a script. This can be handy for such tasks as replacing ordinary spaces with non-breaking spaces (useful for post codes, phone numbers, and that sort of thing); performing calculations (for example, if the Price field is modified, update the Total Price field with Price * the tax rate), and so on.
-
Go to the Admin menu.
-
Expand the Database Setup topic on the left of the window.
-
Select Table and Field Setup.
-
Select the appropriate Table, then double-click on the field you want to add the script to. The Field Properties dialogue opens.
-
Select the Run a Script when modified check box, then click the Select button to choose the script to run.
Run a script when a record is saved
To execute a script whenever a record is saved:
-
Go to the Admin menu.
-
Expand the Database Setup topic on the left of the window.
-
Select Table and Field Setup.
-
Select the appropriate Table.
-
Select the Run a script when a record is saved check box. Select the script to run and Save it.
Note: The script will only run if the record has been modified.
Run a script at any time
As well as running automatically whenever certain actions happen, you can run a script manually at any time.
-
Select the data table that the script will work on, if appropriate.
-
If you want the script to work on only certain records, select them.
-
Click the Run a Script button at the top of the window.
-
Select the script to run.
Ask us about a Custom Script
Do you have a need for a script? Complete this enquiry form and we will get back to you promptly.