Download Elixir Report Designer User Manual
Transcript
Scripting with JavaScript
Figure 6.5. Error logs in Console
This is an expected behavior as the settings in our default policy file (java2.policy) do not allow user
scripts to write a file to the system and the script is trying to write a file named "test" into the system.
JavaScript Cookbook
Alternating colours
To alternate colours in a series of details, declare a count variable in the report header or the group
header, if you are grouping.
// header onRenderBegin
count = 0
In the detail, set the colour based on the modulus of the count and increment count:
// component onRenderBegin
if (count%2==0) setBackgroundColor("Yellow")
else setBackgroundColour("White");
++count;
Hiding and showing components
If you have several components to hide based on a value, declare a boolean that you can check in
renderIf:
// header onRenderBegin
today = new Date();
weekend = today.getDay()==0 || today.getDay()==6;
Now you can check for a weekend (Sunday==0, Saturday==6) and render accordingly:
// component renderIf
weekend
or for weekdays, use not weekend:
// component renderIf
!weekend
99