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 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 HelpConsole 2008 SP1 - ReportsDNA Manual HelpConsole 2008 SP1 - ReportsDNA Manual HelpConsole 2008 SP1 - ReportsDNA Manual

Home > Extensions > How to Create an Extension > SUB SUBMIT_CONFIG

SUB SUBMIT_CONFIG

Remarks

Purpose
This subroutine is typically called when the user clicks the submit button on the form displayed by SHOW_CONFIG to obtain extension settings.  The function calls ReportsDNA setExtensionProperty to save extension-specific report settings. Each extension typically has configuration properties that are used by the extension to determine what data to return for the report.  For example, a database extension will likely require at least 4 properties: database name, user name, user password and query definition.

Number of Extension Properties

Each extension can have 20 properties numbered 1 to 20 inclusive.



Description
The subroutine calls ReportsDNA.setExtensionProperty for each property needed to generate the report. setExtensionProperty will save the property as part of the Report's configuration.  It returns a boolean indicating if the value was set. The following details how to call setExtensionProperty to properly store a property.


Public Function setExtensionProperty(
                  a_propNumber As String, a_value As String, _
    Optional propertyType As Byte = 0, _
    Optional paramInterpret As String = "", _
    Optional paramNum As String = 0, _
    Optional paramLabel As String = "") As Boolean

   
The extension author must define the Property Type and the Property Interpretation Type for each property to specify how ReportsDNA will determine the property's value when the report is generated. 

Property Number

Extensions may have up to 20 properties.  The properties are numbered from 1 to 20 inclusive.  The property number is a string data type.

Property Type

The Property Type setting specifies whether or not the property can contain a parameter and if so, the type of parameter: static or dynamic.  Static parameters are determined without user intervention when the report is generated.  Users are prompted to enter the value(s) for Dynamic parameters each time the report is generated.

Type Value
Description Example Use
TYPE_NORMAL 0
The property does not accept parameters.     
Property: Username
Value: Hiprocates

The username will never change so it is permanently set to Hiprocates.

TYPE_STATIC_PARAMETER

1
The property accepts parameters which are interpreted at the time the report is generated without requiring user input.

Data Source: query defined below.

The application will determine the value for [PARAM1] based on the property's interpretation type.

SELECT * FROM ORDERS WHERE PURCHASE_DATE > [PARAM1]

Example
Value: July 1
The report will always return orders placed after July 1.

TYPE_DYNAMIC_PARAMETER

2
The property accepts parameters.  The report will prompt the user to enter the value(s) for the parameters each time the report is generated. Data Source: query defined below.

The user will be prompted to supply the purchase date when the report is generated.

SELECT * FROM ORDERS WHERE PURCHASE_DATE > [PARAM1]

Example
Value: User-specified each time
The user specifies the date to be used when the report is generated.


Property Interpretation Types

The Property Interpretation Type setting specifies how the property should be interpreted when processed.  See the chart below for the different values for this setting.

Type Value
Description Example Use
INTERPRET_NONE 0
The property's value will not be interpreted.  Use this type when variable interpretation is not required.
Property: Database
Value: Defects

The database name doesn't change; therefore, it does not require any special interpretation. The value specified by the user will be used.

INTERPRET_REPORTSDNA

1
Parameters will be interpreted using the ReportsDNA variable replacement definitions.
Data Source: query defined below.

ReportsDNA will replace [PARAM1] with [DATE]-7, which will be calculated at run time as today's date - 7 days.

SELECT *  FROM ORDERS WHERE PURCHASE_DATE > [PARAM1]

User-specified value:[DATE]-7

Example
Today's Date: July 8
Interpreted Value: July 1

INTERPRET_MACRO

2
A macro (typically defined in the extension) which will return the value.
Data Source: query defined below.

ReportsDNA will assign the value returned by the macro specified for this property.

SELECT * FROM ORDERS WHERE PURCHASE_DATE > [PARAM1]


Parameter Number

The property number that contains the value for another property that accepts parameters.

Example

Property 1 accepts parameters but does not prompt the user for the value at runtime (TYPE = TYPE_STATIC_PARAMETER).

Property 1 contains a query that requests orders purchased [PARAM1] days in the past ( SELECT * FROM ORDERS WHERE PURCHASE_DATE > [DATE]-[PARAM1] ).

Property 1  uses the value stored in Property 2  ( 7) as the default value for [PARAM1].


If run on July 8, Property 1  will be evaluated as follows:

SELECT * FROM ORDERS WHERE PURCHASE_DATE > [DATE]-[PARAM1]

SELECT * FROM ORDERS WHERE PURCHASE_DATE > July 8 - 7

SELECT * FROM ORDERS WHERE PURCHASE_DATE > JULY 1


Property  Number
Type
Interpretation Type
Value
Parameter Number
1

TYPE_STATIC_PARAMETER

INTERPRET_REPORTSDNA

SELECT * FROM ORDERS WHERE PURCHASE_DATE > [DATE]-[PARAM1] 2
2
TYPE_NORMAL INTERPRET_NONE 7
[nothing]


Parameter Label

Specifies the prompt to display to the user when the user must enter a value for dynamic parameters.



Mandatory: No

Example

Download RNA-Example Addin

Private Sub btnOk_click()
 
    With frmConfig
    'Fields that don't take parameters
        Call ReportsDNA.setExtensionProperty("1", .TextBoxNumFields.Value)
        Call ReportsDNA.setExtensionProperty("3", .TextBoxtParameters.Value)
        Call ReportsDNA.setExtensionProperty("4", CStr(CInt(.checkboxPromptParameters.Value)))
       
    'Fields that take parameters
        'The "TextBoxNumFields" property accepts parameters
        'it will take PARAMX type parameters that are specified in the parameter field

       
        Dim propType As Byte
        propType = IIf(.checkboxPromptParameters.Value, ReportsDNA.TYPE_DYNAMIC_PROPERTY,
ReportsDNA.TYPE_STATIC_PROPERTY) 'TYPE_STATIC_PROPERTY=don't prompt user for value, TYPE_DYNAMIC_PROPERTY=prompt user for value each time report is run
       
        Dim paramInterpret As String
        paramInterpret = ReportsDNA.INTERPRET_NONE    '0=the property will not be interpreted, 1=RNA interpretation, 2=extension interpretation by calling a macro
        Call ReportsDNA.setExtensionProperty(
              "2",                     'set property #2
              .TextBoxNumRows.Value,   'save the number of rows
              propType,                '1=don't prompt for value at runtime, 2=prompt for value at runtime _
              paramInterpret,          '0=property not interpreted, 1=RNA interpretation, 2=extension interpretaton by calling a macro
              "3",                     'if user is not prompted for value then use the value in property #3
              "Enter Number of Rows"'if user IS prompted for value then display this prompt
    End With
   
    Unload Me
End Sub


Property Type = TYPE_DYNAMIC_PROPERTY  (prompt for property value)

Prompt for property value when report is generated.



See also

Reference to ReportsDNA
Function RNA_PROPERTIES
Function SHOW_CONFIG
Function GET_DATA