Creating a new script doesn’t have to be complicated! Our SAREscript platform offers simple and intuitive tools to help you through the process. Start by selecting SAREscript → launch in the main menu.
Determining the Data Source
The first step in creating a script is to specify the data source. You can do this by clicking on the data source button. Below are some possibilities:
- None – if you do not need the data for the script to work.
- The entire base – if you want to provide all addresses for the operation of the script.
- Selected data – if the script is to work on sample data (from the selected address or entered manually).
- Selected addresses – addresses from selected groups or the entire database with the ability to filter addresses, both simple and advanced.
- Addresses from shipment – if you select this option, you will see the numbers of shipments to choose from which addresses will be selected.
Creating a Script
Once the data source is defined, we can move on to creating the script. The text box in the center of the page is used for this purpose. You can enter the script “manually” according to the syntax or use the ready-made script templates that are available on our site.
In the scripts section, available on the right, there is a list of ready-made scripts. Selecting one of them opens a form where you have to define certain features and values necessary for the script to work. After clicking ok, the script code will move to the editor.
Here are some sample scripts for you to choose from:
- Determine gender – based on the recipient’s name, the gender is determined, and then it is saved to a new feature.
- Determine the city – based on the postal code of the recipient (in XX-XXX format), the city is determined, and then it is saved to a new feature.
- Determine the province – based on the postal code of the recipient (in XX-XXX format), the province is determined, and then it is saved to a new feature.
- Change trait value – if the selected trait has a certain value, the script sets the value of the other trait to a different value.
- Generate discount codes – the script generates a code consisting of the selected types of characters and the specified number of characters, and then writes it to the selected feature.
- Draw addresses – the script draws a certain number of addresses from selected groups, and then copies the drawn addresses to the specified group.
Saving and Debugging the Script
Once you have finished writing your script, you can run, save or debug it. To select the appropriate option, just choose it from the drop-down list under the code editor.
- Execute script – runs the script after clicking the ok button.
- Save script – allows you to save the script under the specified name. After clicking ok, the script will be saved and will be available in the Your Scripts list.
- Debug the script – allows you to check how the script works step by step and helps you find any errors.
After the script is executed or debugged, messages are generated in the result field. They contain information about the progress of the script execution (number of processed records), the result of the action and the processing time. You can download the result of the script in a txt file by clicking on the download result file link.