HelpConsole 2008 SP1 - ReportsDNA Manual HelpConsole 2008 SP1 - ReportsDNA Manual HelpConsole 2008 SP1 - ReportsDNA Manual HelpConsole 2008 SP1 - ReportsDNA Manual HelpConsole 2008 SP1 - ReportsDNA Manual HelpConsole 2008 SP1 - ReportsDNA Manual

Home > Extensions > How to Create an Extension > Function GET_DATA

Function GET_DATA


PUBLIC Function GET_DATA(destination As String, populateHeadings As Boolean, rnax As ReportsDNA.RNAExtension,   Optional reportConfig) As Range

Remarks

Purpose
A function that generates or retrieves the source data for the report.

Remarks
This function is called by ReportsDNA when the user generates the report.

The name of the function does NOT have to be named GET_DATA.  The name is set by the extension author in the RNA_PROPERTIES function.

Mandatory: Yes

Example

Download RNA-Example Addin

Public Function GET_DATA(destination As String, populateHeadings As Boolean, rnax As reportsdna.RNAExtension, _
    Optional reportConfig) As Range

'Function called by ReportsDNA to return the data for the report
'Returns a Range indicating the resultant dataset (to include field names)
'Argument           Description
'====================================================================
'destination        starting cell of output range. e.g. if destination = "C5" then row 5 contains field names (w/the first field name in cell C5), _
'                   row6+ contains data.
'populateHeadings   IF true, THEN include field names in data set ELSE only include data
'reportConfig       reserved for future use - a dictionary object that contains report settings


    Dim numFields As Integer, numRows As Integer
    Dim interpretParameters As Boolean  'flag that specifies if the parameters in a property should be returned statically (not evaluated) or dynamically (evaluated)
    interpretParameters = True          'evaluate parameters in each property since we are generating the report
   
    numFields = CInt(reportsdna.getExtensionProperty(1, interpretParameters))
    numRows = CInt(reportsdna.getExtensionProperty(2, interpretParameters))
   
    'range containing field names and dataset
    Dim resultsrange As Range
    Set resultsrange = Range(Range(destination), Range(destination).Offset(numRows, numFields - 1))
   
   
    Dim fields  'array containing field names
    Dim dataset 'array containing field names and dataset
    dataset = retrieveData(numFields, numRows, fields)      'generate data for report
   
    'copy data to excel worksheet
    resultsrange.Value = dataset
   
    'MANDATORY: set number of records and array containing field (column) names
    rnax.RecordCount = UBound(dataset) - LBound(dataset)
    rnax.columnheadings = fields

   
    'MANDATORY return range that contains field names and dataset
    Set GET_DATA = resultsrange
End Function



See also

Reference to ReportsDNA
Function RNA_PROPERTIES
Function SHOW_CONFIG
SUB SUBMIT_CONFIG