BKS Shorts Report Designer has the ability to create XojoScripts that can modify the band of report at when the report is generated. This means that any item in the band can be modified in certain ways such as hiding fields, or changing styles. A brief explanation of Xojoscript can be found here

Creating a XojoScript for a Band

Select the Band to display the Band properties in the Property List. Under the Behavior header is the Script field. Click the ellipsis to bring up the Script Editor.

The Script Editor is a simple TextArea that has been modified so a Contextual Menu Click (right-click) allows you to add commands. The commands are listed here with documentation for each of them.

Right-click anywhere in the text area to see the available commands. Select one from the menu to insert it into the script editor. There will be a <UID> section of the text that is the identifier. Right click on the UID section to bring up a listing of UID’s in the Band. Select the item in the list and it will automagically fill in. Setting styles is similar and has a <Style> marker. Right click on it to see the available Styles in this report.

Example Script

Below is a example band script that gets the string value from the field testdata.Number011, converts it to a double, then if the value is less than 1,000 it will set the Style of the UID’s indicated to the style named "Red Text."

dim s as String = SC_GetFieldStringValue("testdata.Number011")
dim d as Double = Val(s)

if d < 1000 then
  SC_SetStyle("testdata.Name051","Red Text")
  
  SC_SetStyle("testdata.IP061","Red Text")
  SC_SetStyle("testdata.gem081","Red Text")
  SC_SetStyle("testdata.Number011","Red Text")
end

Warning

While using XojoScript makes the Report Designer incredibly powerful it also has some important considerations to take into account. Please consider these issues before using Band Scripts.

  • The Band's XojoScript is run each time that band is generated. So if a report has 10,000 rows, the XojoScript will be loaded, compiled, and run all 10,000 times.
  • A XojoScript error may cause the report to end prematurely.