A little more detail about 2:
Data-bound properties have different values on the "BIAL" side and on the runtime (SDK component) side. We also talk about design time and runtime value (which is not 100% correct).
The design time value is the selection JSON, e.g. {"Dim1": ["val1, "val2"]} that select the data area.
You CAN modify this value, both from Designer and from BIAL scrpting.
In your contribution.ztl write a getter, e.g.
void setDataSelection(/* A selection specifying the result set from a data source */ String selection) {*
this.data = selection;
*}
At runtime the "data" property will receive the selected data (and metadata merged or in extra "metadata" property.
Btw: the Simple Crosstab sample shows some of the advanced possibilities to script data selection:
// Same as before, but using "ResultSetSelection" gives good content assist in designer,
// and allows to pass in the JSON directly and not as string
void setDataSelection(/* A selection specifying the result set from a data source */ ResultSetSelection selection) {*
this.data = this.stringifySelection(selection);
*}