• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
        • Compress Function
        • Decompress Function
        • Diagnostics Function
        • Encode Function
        • ErrMsg Function
        • ExecSystem Function (Desktop)
        • ExecSystem Function (Mobile)
        • ExecPFF Function
        • GetProperty Function
        • GetLabel Function
        • GetLanguage Function
        • GetSymbol Function
        • GetValueLabel Function
        • Hash Function
        • HtmlDialog Function
        • InValueSet Function
        • Invoke Function
        • IsChecked Function
        • LoadSetting Function
        • LogText Function
        • MaxValue Function
        • MinValue Function
        • Paradata Function
        • PathConcat Function
        • PathName Function
        • Report Function (Deprecated)
        • SaveSetting Function
        • SetLanguage Function
        • SetProperty Function
        • SetReportData Function (Deprecated)
        • SetValueSet Function
        • SetValueSet Function With Arrays
        • SetValueSets Function
        • Special Function
        • SqlQuery Function
        • Stop Function
        • SysParm Function
        • Tr Function
        • Trace Function
        • UUID Function
        • View Function
        • Warning Function
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
      • Export Attributes
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Appendix
  • <Helps for CSEntry>
  • <Helps for CSBatch>
  • <Helps for CSTab>
  • <Helps for DataViewer>
  • <Helps for TextView>
  • <Helps for TblView>
  • <Helps for TRSWin>
  • <Helps for CSDeploy>
  • <Helps for CSPack>
  • <Helps for CSFreq>
  • <Helps for CSSort>
  • <Helps for CSExport>
  • <Helps for CSReFmt>
  • <Helps for CSDiff>
  • <Helps for CSConcat>
  • <Helps for TRSSetup>
  • <Helps for ParadataViewer>
  • <Helps for ParadataConcat>
  • <Helps for CSIndex>
  • <Helps for Excel2CSPro>
  • <Helps for CSWeb>

SetReportData Function (Deprecated)

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.
Format
b = setreportdata(ʃattribute,ʅ data_source);
Description
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_sourceDescription
valueA string expression containing some text.
record_nameThe 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_nameThe contents of a list.
array_nameThe contents of a one- or multiple-dimensional array.
sqlqueryThe 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).
Return Value
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).
Example - Text and Record
setreportdata("title", "Demographic Report");
setreportdata(PERSON_REC);
Example - SqlQuery
string DeviceQuery =
   
"SELECT device_model, COUNT(*) AS device_count "
   
"FROM device_info "
   
"GROUP BY device_model;";

setreportdata("device_info", sqlquery(paradata, DeviceQuery));
See also: Report Function (Deprecated), SqlQuery Function, Templated Reports (Deprecated)