With embedded code, you can control the internal elements of a report. But with scripting, you can also control outside elements, like:

  • Ask users about what's going to be in the report, so the report is customized. This eliminates the need to have multiple similar reports.
  • Create an export or import of data. In this case, you might not generate any sort of printout.
  • Sort or manipulate the data in a way that's not designed into the system.

When you run the report, the script is activated. PDS uses the Pascal scripting language, which is what you used when you embedded code. However, there are some differences.

Accessing the Script

In the Select Report window, select the advanced report you want to modify, and click Adv. Script. Click the Pascal Script File tab. In this text box, you can create or edit the script code. The following are differences between writing script and embedded code:

  • All the code of a script is in one location. There isn't a separate window for each routine.
  • You must enter all of the code, including the procedure declarations.
  • Field names are different.
  • Errors may not display until you run the report. Click Check Code to find simple syntax errors.

Scripting Objects

In reports, objects are items you insert into the ARW editor. In scripts, objects are more complicated. Everything on your screen and everything in the program tables are objects.

For example, the family table is an object that's stored in another object called a "datamodule" (DM). To go to the first family, enter the following line in the script:

PDSDMData.FamTbl.First; // Tells program to access the PDSDMData datamodule,
						// find the FamTbl object, then run "First" routine.