headerBand example
Suppose you’re tracking sales and want to generate a summary report, grouped by quarter. You’ve already created a calculated field "Quarter" that contains a number from 1 to 4. To print "1st quarter", "2nd quarter" and so forth, set the text property of an Text component to the following expression codeblock (all in one line):
{||{"1st","2nd","3rd","4th"}
[this.parent.parent.parent.rowset.fields["Quarter"].value] +
" quarter"}
This codeblock uses a literal array that contains the corresponding text for the quarter number. To get the quarter number in the calculated field "Quarter" from the Text component:
this is the component
the component’s parent is the headerBand
the headerBand’s parent is the Group object
the group’s parent is the StreamSource object
from the StreamSource object, you can access its rowset