Feature Upgrade: Starting with CSPro 7.7, the version of Templated Reports that uses setreportdata has been superseded by a new version, Templated Reports. This version will be removed in a future version of CSPro.
b = setreportdata(ʃattribute,ʅ data_source);
The
setreportdata function stores in memory a piece of data that will later be used by the
report function to generate a
templated report. The string expression
attribute specifies the key, or tag, that uniquely identifies the piece of data. The attribute is case sensitive. In the report template, you will use this attribute to refer to this data.
The data_source must be one of the following:
data_source | Description |
value | A string expression containing some text. |
record_name | The contents of a record, including multiply occurring records. In a data entry application, only information up to the number of entered occurrences will be stored. |
list_name | The contents of a list. |
array_name | The contents of a one- or multiple-dimensional array. |
sqlquery | The result set of a query executed by the sqlquery function. Do not specify that function's optional result_set argument, as the result set is stored in memory when called by setreportdata. |
It is not necessary to specify the attribute when working with a record_name, list_name, or array_name. If no attribute is specified, then it will default to the name of the record, list, or array.
You can clear all stored data by executing:
setreportdata(clear).
The function returns a logical value of 1 (true) if the data was stored successfully, and 0 (false) otherwise (for example if the
sqlquery function encountered a problem).
setreportdata("title", "Demographic Report");
setreportdata(PERSON_REC);
string DeviceQuery =
"SELECT device_model, COUNT(*) AS device_count "
"FROM device_info "
"GROUP BY device_model;";
setreportdata("device_info", sqlquery(paradata, DeviceQuery));