ActiveReports 14
ActiveReports 14 User Guide / Concepts / ActiveReports Web Designer / Designer Server API Object
In This Topic
    Designer Server API Object
    In This Topic
    The module baseServerApi.js contains certain functions required for Web Designer operation related to reports, data, themes, images, and report templates. These functions are described as follows. For more information, see Web Designer API.
    Note: Certain properties and functions are marked 'Reserved' since these are not relevant in ActiveReports 14 (for example report revisions) but it is still required to have them for proper working of Web Designer. Web Designer is used not only in ActiveReports 14 but also in older version in ActiveReports Server.

    Reports

    GET REPORTS LIST

    Parameters Return Value Response Model
    getReportsList() Promise Array<ReportsListItem>

    REPORTS LIST ITEM OBJECT

    Copy Code
    type ReportsListItem = {
      _id: string, // report id
      Name: string, // report name
      IsCpl: boolean, // specifies whether report is RDL or FPL
      Type: 'PageReport', // RESERVED - for now only 'PageReport' is supported
      $effectivePermissions: 'All', // RESERVED - for now only 'All' is supported
    }
    

    GET REPORT CONTENT

    Parameters Return Value Response Model
    getReportContent(options: GetReportContentOptions) Promise Report JSON Model

    GET REPORT CONTENT OPTIONS OBJECT

    Copy Code
    type GetReportContentOptions {
      id: string, // report id
      version: null, // RESERVED - for now only null is supported
    }
    

    GET REPORT REVISIONS - RESERVED

    Parameters Return Value Response Model
    getReportRevisions(options: GetReportRevisionsOptions) Promise Array<ReportRevision>

    GET REPORT REVISIONS OPTIONS OBJECT

    Copy Code
    type GetReportRevisionsOptions {
    id: string, // report id
    }
    

    REPORT REVISION OBJECT

    Copy Code
    type ReportRevision = {
    _id: string, // report id
    Name: string, // report name
    IsCpl: boolean, // specifies whether report is RDL or FPL
    Type: 'PageReport', // RESERVED - for now only 'PageReport' is supported
    $effectivePermissions: 'All', // RESERVED - for now only 'All' is supported
    }
    

    SAVE NEW REPORT

    Parameters Return Value Response Model
    saveNewReport(options: SaveNewReportOptions) Promise SaveReportResponse

    SAVE NEW REPORT OPTIONS OBJECT

    Copy Code
    type SaveNewReportOptions = {
      name: string, // report name
      content: object, // report JSON model
    }
    

    SAVE REPORT RESPONSE OBJECT

    Copy Code
    type SaveReportResponse = {
      Id: string, // saved report id
    }
    

    SAVE EXISTING REPORT

    Parameters Return Value Response Model
    saveExistingReport(options: SaveExistingReportOptions) Promise SaveReportResponse

    SAVE EXISTING REPORT OPTIONS OBJECT

    Copy Code
    type SaveExistingReportOptions = {
      id: string, // report id
      content: object, // report JSON model
    }
    

    SAVE TEMPORARY REPORT

    Parameters Return Value Response Model
    saveTemporaryReport(options: SaveTemporaryReportOptions) Promise SaveReportResponse

    SAVE TEMPORARY REPORT OPTIONS OBJECT

    Copy Code
    type SaveTemporaryReportOptions = {
      name: string, // report name
      content: object, // report JSON model
    }
    

    DELETE TEMPORARY REPORT

    This is an optional service function that is used outside of Designer. It can be used for deleting temporary reports when Report Viewer is closed and view is switched back to Designer.

    Parameters Return Value Response Model
    deleteTemporaryReport(options: DeleteTemporaryReportOptions) Promise DeleteReportResponse

    DELETE TEMPORARY REPORT OPTIONS OBJECT

    Copy Code
    type DeleteTemporaryReportOptions = {
      id: string, // report id
    }
    

    DELETE REPORT RESPONSE OBJECT

    Copy Code
    type DeleteReportResponse = {
      Id: string, // deleted report id
    }
    

    Data

    GET DATA SETS LIST

    Parameters Return Value Response Model
    getDataSetsList() Promise Array<DataSetsListItem>

    DATA SETS LIST ITEM OBJECT

    Copy Code
    type DataSetsListItem = {
      id: string, // data set id
      name: string, // data set name
      version: null, // RESERVED - for now only null is supported
    }
    

    GET DATA SOURCES AND DATA SETS

    Parameters Return Value Response Model
    getDataSourcesAndDataSets(options: GetDataSourcesAndDataSetsOptions) Promise GetDataSourcesAndDataSetsResponse

    WHETHER A DATA SOURCE CAN BE EDITED

    Parameters Return Value Response Model
    canEditDataSource(options: CanEditDataSourceOptions) Promise GetDataSourcesAndDataSetsResponse

    GET CANEDITDATASOURCE OPTIONS OBJECT

    Copy Code
    type CanEditDataSourceOptions = {
        /** data source */
        dataSource: DataSource;
        /** data provider of data source */
        dataProvider: string;
    };
    

    WHETHER A DATASET CAN BE CREATED FOR A SPECIFIC DATA SOURCE

    Parameters Return Value Response Model
    canAddDataSetForDataSource(options: CanAddDataSetForDataSourceOptions)) Promise GetDataSourcesAndDataSetsResponse

    GET CANADDDATASETFORDATASOURCE OPTIONS OBJECT

    Copy Code
    type CanAddDataSetForDataSourceOptions = {
        /** data source */
        dataSource: DataSource;
        /** data provider of data source */
        dataProvider: string;
    };
    

    WHETHER A DATA SET CAN BE EDITED

    Parameters Return Value Response Model
    canEditDataSet:(options: CanEditDataSetOptions) Promise GetDataSourcesAndDataSetsResponse

     

    GET EDITDATASET OPTIONS OBJECT

    Copy Code
    type CanEditDataSetOptions = {
        /** data set */
        dataSet: DataSet;
        /** data provider of data set's parent data source */
        dataProvider: string;
    };
    

    RETURNS A DATA SET INITIALIZED FOR A SPECIFIC DATA SOURCE

    Parameters Return Value Response Model
     initDataSetForDataSource:(options: InitDataSetForDataSourceOptions) Promise

    GetDataSourcesAndDataSetsResponse

    GET INITDATASETFORDATASOURCE OPTIONS OBJECT

    Copy Code
    type InitDataSetForDataSourceOptions = {
        /** data source */
        dataSource: DataSource;
        /** data provider of data source */
        dataProvider: string;
        /** data set name to be initialized */
        dataSetName: string;
    };
    

     

    GET PROPERTIES AVAILABLE FOR A SPECIFIC DATA SET

     

    Parameters Return Value Response Model
     getDataSetProperties:(options: GetDataSetPropertiesOptions) Promise

    GetDataSourcesAndDataSetsResponse

    GET GETDATASETPROPERTIES OPTIONS OBJECT

    Copy Code
    type GetDataSetPropertiesOptions = {
        /** data provider of data set's parent data source */
        dataProvider: string;
    };
    

    GET GETDATASETPROPERTIES RESPONSE OBJECT

    Copy Code
    type DataSetProperty = 'name' | 'commandType' | 'query' | 'fields' | 'calculatedFields' | 'parameters' | 'filters'  | 'caseSensitivity' | 'collation' | 'kanatypeSensitivity' | 'widthSensitivity' | 'accentSensitivity';
    

    GET SCHEMA FOR A SPECIFIC DATA SET

    Parameters Return Value Response Model
     getDataSetSchema(options: GetDataSetSchemaOptions) Promise

    GetDataSourcesAndDataSetsResponse

     

    GET GETDATASETSCHEMA OPTIONS OBJECT

    Copy Code
    type GetDataSetSchemaOptions = {
        /** data set */
        dataSet: DataSet;
        /** data set's parent data source */
        dataSource: DataSource;
    };
    

     

    GET GETDATASETSCHEMA RESPONSE OBJECT

    Copy Code
    type GetDataSetSchemaResponse = {
        /** data set fields */
        fields: Array<Field>;
        /** data set query parameters */
        parameters: Array<QueryParameter>;
    };
    

     

    GET DATA SOURCES AND DATA SETS

    Parameters Return Value Response Model

    getDataSourcesAndDataSets(options: GetDataSourcesAndDataSetsOptions)

    Promise

    GetDataSourcesAndDataSetsResponse

    GET DATA SOURCES AND DATA SETS OPTIONS OBJECT

    Copy Code
    type GetDataSourcesAndDataSetsOptions = {
      dataSetInfo: {
        id: string, // data set id
        name: string, // data set name
        version: null, // RESERVED - for now only null is supported
      },
      dataSourceInfo: object, // RESERVED
      reportDataSets: Array<DataSet>, // data sets used in report
      reportDataSources: Array<DataSource>, // data sources used in report
    }
    

    GET DATA SOURCES AND DATA SETS RESPONSE OBJECT

    Copy Code
    type GetDataSourcesAndDataSetsResponse = {
      dataSources: Array<DataSource>,
      dataSets: Array<DataSet>,
    }
    

    ****

    GET DATA SET CONTENT

    This function is intended to be used in getDataSourcesAndDataSets(). The result dataSetContent object may store information required to create a data set and its parent data source.

    Parameters Return Value Response Model
    getDataSetContent(options: GetDataSetContentOptions) Promise dataSetContent: object

    GET DATA SET CONTENT OPTIONS OBJECT

    Copy Code
    type GetDataSetContentOptions = {
      id: string, // data set id
    }
    

    DATA SOURCE AND DATA SET OBJECTS

    Basic properties of DataSource and DataSet types are listed. Object models of DataSource and DataSet correlate with their structure in RDLX report definition.

    Copy Code
    type DataSource = {
      Name: string, // data source name
      ConnectionProperties: {
        ConnectString: string, // connection string
        DataProvider: string, // data provider - see AR Documentation
      },
      // ... more properties - see AR Documentation
    }
    type DataSet = {
      Name: string, // data set name
      Fields: Array<Field>, // data set fields
      Query: {
        DataSourceName: string, // parent data source name
        CommandType: 'Text' | 'StoredProcedure', // query command type
        CommandText: string, // query command text
        QueryParameters: Array<QueryParameter>,
      }
      // ... more properties - see AR Documentation
    }
    type Field = {
      Name: string, // field name
      // Either DataField or Value needs to be available.
      DataField?: string, // data field name - valid for bound fields
      Value?: string, // field value - valid for calculated fields
      /* Extra optional properties */
      // default field aggregate - see AR Documentation for more available aggregates
      Aggregate?: 'Count' | 'Sum' | 'Max' | 'Min' /* etc. */,
      // field data type
      DataType?: 'String' | 'Integer' | 'Float' | 'Number' | 'Boolean' | 'DateTime',
    }
    type QueryParameter = {
      Name: string, // query parameter name
      Value: string, // query parameter value
    }
    

    OPEN DATA SOURCE EDITOR IMPLEMENTATION

    Copy Code
    /* Optional: Add/Edit Data Sources using Data Source Editor */
    var openDataSourceEditorImpl = function (options) {
            ARDataSourceEditor.open(makeOptions(options, {
                    serverApi: {
                            testConnection: baseServerApi.testDataSourceConnection,
                    },
            }));
    };                        
    

    CAN EDIT DATA SOURCE OPTIONS

    Copy Code
    export type CanEditDataSourceOptions = {
            /** data source */
            dataSource: DataSource;
    
            /** data provider of data source */
            dataProvider: string;
    };
    
    export type CanEditDataSetOptions = {
            /** data set */
            dataSet: DataSet;
    
            /** data provider of data set's parent data source */
            dataProvider: string;
    };                  
    

    INIT DATA SET FOR DATA SOURCE OPTIONS

    Copy Code
    export type InitDataSetForDataSourceOptions = {
    /** data source */
    dataSource: DataSource;
    
    /** data provider of data source */
    dataProvider: string;
    
    /** data set name to be initialized */
    dataSetName: string;
    };    
    

    GET DATA SET PROPERTIES OPTIONS

    Copy Code
    export type GetDataSetPropertiesOptions = {
            /** data provider of data set's parent data source */
            dataProvider: string;
    };
    
    export type DataSetProperty = 'name' | 'commandType' | 'query' | 'fields' | 'calculatedFields' | 'parameters' | 'filters'
    | 'caseSensitivity' | 'collation' | 'kanatypeSensitivity' | 'widthSensitivity' | 'accentSensitivity';
    

    GET DATA SET SCHEMA OPTIONS

    Copy Code
    export type GetDataSetSchemaOptions = {
            /** data set */
            dataSet: DataSet;
    
            /** data set's parent data source */
            dataSource: DataSource;
    };
    

    GET DATA SET SCHEMA RESPONSE

    Copy Code
    export type GetDataSetSchemaResponse = {
            /** data set fields */
            fields: Array;
    
            /** data set query parameters */
            parameters: Array;
    };
    

    OPEN DATA SOURCE EDITOR BASE OPTIONS

    Copy Code
    export type OpenDataSourceEditorBaseOptions = {
            /** locale passed by Designer */
            locale: 'en' | 'ja' | 'zh';
    
    
            /** **Non-null** if an existing data source edited, **null** - if a new one is created. */
            dataSource: DataSource | null;
    
            /** data sources used in report */
            reportDataSources: Array;
    
    
            /** callback on successful data source editing/creation */
            onSuccess: (options: DataSourceEditorOnSuccessOptions) => void;
    
            /** callback on closing Data Source Editor */
            onClose: () => void;
    };
    

    DATA SOURCE EDITOR ONSUCCESS OPTIONS

    Copy Code
    export type DataSourceEditorOnSuccessOptions = {
            /** successfully created or edited data source */
            dataSource: DataSource;
    };
    

    OPEN DATA SET PICKER BASE OPTIONS

    Copy Code
    export type OpenDataSetPickerBaseOptions = {
            /** locale passed by Designer */
            locale: 'en' | 'ja' | 'zh';
    
            /** If mode is **Panel**, Data Set Picker is rendered within **Data** tab. */
            mode: DataSetPickerMode;
    
            /** If mode is not **Panel**, Data Set Picker is rendered to an element with this id. */
            elementId?: string;
    
            /** data sources used in report */
            reportDataSources: Array;
    
            /** data sets used in report */
            reportDataSets: Array;
    
            /** New data sources and data sets to be added are passed as parameters to this function. */
            addDataSourcesAndDataSets: (options: AddDataSourcesAndDataSetsOptions) => void;
    
            /** callback on closing Data Set Picker */
            onClose: () => void;
    };
    

    DATA SET PICKER MODE

    Copy Code
    export type DataSetPickerMode = 'Panel' | 'Dialog';
    

    ADD DATA SOURCES AND DATA SETS OPTIONS

    Copy Code
    export type AddDataSourcesAndDataSetsOptions = {
            /** data sources to-be-added */
            dataSources: Array;
    
            /** data sets to-be-added */
            dataSets: Array;
    };
    

    CAN ADD DATA SET FOR DATA SOURCE OPTIONS

    Copy Code
    export type CanAddDataSetForDataSourceOptions = {
            /** data source */
            dataSource: DataSource;
    
            /** data provider of data source */
            dataProvider: string;
    };                
    

    DATA SOURCE EDITOR API

    Copy Code
                       /**
     * Type of **ARDataSourceEditor** object exported by **ar-datasource-editor.js** module.
     */
    export type DataSourceEditorApi = {
            /* Initializes **Data Source Editor** using the specified **DataSourceEditorInitOptions** object and renders it to ** element with id **dataSourceEditorElementId**.
             * 
             * **Example:**
             * ```javascript
             * ARDataSourceEditor.init('data-source-editor-id', dataSourceEditorInitOptions);
             * ```
             * 
             * @param dataSourceEditorElementId string
             * @param options DataSourceEditorInitOptions object
             */
            init: (dataSourceEditorElementId: string, options?: DataSourceEditorInitOptions) => void;
    
            /**
             * Opens Data Source Editor.
             * 
             * **Example:**
             * ```javascript
             * ARDataSourceEditor.open(dataSourceEditorOptions);
             * ```
             * 
             * @param options DataSourceEditorOptions object
             */
            open: (options: DataSourceEditorOptions) => void;
    };
    
    export type CustomProviderDescriptor = {
            /**
             * key - data provider identifier\
             * This value is used for **DataSource.ConnectionProperties.DataProvider** property.
             */
            key: string;
    
            /**
             * name - data provider label\
             * This value is used as a friendly data provider label in UI.
             */
            name: string;
    };
    
    export type DataSourceEditorInitOptions = {
            /** predefined providers */
            predefinedProviders?: Array;
    
            /** OLE DB providers */
            oleDbProviders?: Array;
    
            /** custom providers */
            customProviders?: Array;
    };
    
    export type PredefinedProvider = 'SQL' | 'OLEDB' | 'ODBC' | 'JSON' | 'CSV' | 'XML';
    
    export type OleDbProvider = PredefinedOleDbProvider | string;
    
    export type PredefinedOleDbProvider = 'Microsoft.Jet.OLEDB.4.0' | 'SQLOLEDB.1' | 'MSDataShape.1' | 'MSDASQL.1';
    
    export type DataSourceEditorOptions = OpenDataSourceEditorBaseOptions & {
            /** Specifies custom localization data. */
            localeData?: Array;
                            
    

    DATA SOURCE EDITOR SERVER API

    Copy Code
    /** **Data Source Editor** server API */
            serverApi: {
                    /**
                     * Tests data source connection.
                     * 
                     * @param options TestConnectionOptions object
                     */
                    testConnection: (options: TestConnectionOptions) => Promise;
            };
    };
    
    export type TestConnectionOptions = {
            /** data source */
            dataSource: DataSource;
    };
    
    export type TestConnectionResponse = {
            /** error code - 0 means success */
            Code: number;
    
            /** databases list available for test connection settings */
            Databases: Array | null,
    
            /** error message */
            Error: string | null,
    };                
    

    Themes

    GET THEMES LIST

    Parameters Return Value Response Model
    getThemesList() Promise Array<ThemesListItem>

    THEMES LIST ITEM OBJECT

    Copy Code
    type ThemesListItem = {
      _id: string, // theme id
      Name: string, // theme name
      IsDefault: boolean, // specifies whether theme is default or not, only a single theme can be default
      Dark1: string, // Dark1 theme color
      Dark2: string, // Dark2 theme color
      Light1: string, // Light1 theme color
      Light2: string, // Light2 theme color
      Accent1: string, // Accent1 theme color
      Accent2: string, // Accent2 theme color
      Accent3: string, // Accent3 theme color
      Accent4: string, // Accent4 theme color
      Accent5: string, // Accent5 theme color
      Accent6: string, // Accent6 theme color
      MajorFontFamily: string, // Major text theme font family
      MinorFontFamily: string, // Minor text theme font family
    }
    

    GET THEME CONTENT

    Parameters Return Value Response Model
    getThemeContent(options: GetThemeContentOptions) Promise ThemeModel

    GET THEME CONTENT OPTIONS OBJECT

    Copy Code
    type GetThemeContentOptions = {
      id: string, // theme id
    }
    

    THEME MODEL OBJECT

    Copy Code
    type ThemeModel = {
      Colors: {
        Dark1: string, // Dark1 theme color
        Dark2: string, // Dark2 theme color
        Light1: string, // Light1 theme color
        Light2: string, // Light2 theme color
        Accent1: string, // Accent1 theme color
        Accent2: string, // Accent2 theme color
        Accent3: string, // Accent3 theme color
        Accent4: string, // Accent4 theme color
        Accent5: string, // Accent5 theme color
        Accent6: string, // Accent6 theme color
        Hyperlink: string, // Hyperlink theme color
        HyperlinkFollowed: string, // Followed hyperlink theme color
      },
      Fonts: {
        MajorFont: ThemeFont,
        MinorFont: ThemeFont,
      }
      Images: Array<ThemeImage>,
      Constants: Array<ThemeConstant>,
    }
    type ThemeFont = {
      Family: string, // font family
      Style: string, // font style
      Size: string, // font size
      Weight: string, // font weight
    }
    type ThemeImage = {
      Name: string, // image name
      MIMEType: string, // image MIME type
      ImageData: string, // Base64 image data
    }
    type ThemeConstant = {
      Key: string, // constant key
      Value: string, // constant value
    }
    

    Images

    GET IMAGES LIST

    Parameters Return Value Response Model
    getImagesList() Promise Array<ImagesListItem>

    IMAGES LIST ITEM OBJECT

    Copy Code
    type ImagesListItem = {
      _id: string, // image id
      Name: string, // image name
      MimeType: string, // image MIME type
      Thumbnail: null, // RESERVED - for now only null is supported
    }
    

    GET IMAGE URL

    This url is used to display external image in design-time.

    Parameters Return Value
    getImageUrl(options: GetImageUrlOptions) imageUrl: string

    GET IMAGE URL OPTIONS OBJECT

    Copy Code
    type GetImageUrlOptions = {
      id: string, // image id
    }
    

    Report Templates

    GET TEMPLATES LIST

    This function can be used in some custom File View implementation.

    Parameters Return Value Response Model
    getTemplatesList() Promise Array<TemplatesListItem>

    TEMPLATES LIST ITEM OBJECT

    Copy Code
    type TemplatesListItem = {
      _id: string, // template id
      Name: string, // template name
    }
    

    GET TEMPLATE CONTENT

    Parameters Return Value Response Model
    getTemplateContent(options: GetTemplateContentOptions) Promise Report JSON Model

    GET TEMPLATE CONTENT OPTIONS OBJECT

    Copy Code
    type GetTemplateContentOptions = {
      id: string, // template id
    }
    

    GET TEMPLATE THUMBNAIL

    This function can be used in some custom File View implementation.

    Parameters Return Value Response Model
    getTemplateThumbnail(options: GetTemplateThumbnailOptions) Promise base64ImageData: string

    GET TEMPLATE THUMBNAIL OPTIONS OBJECT

    Copy Code
    type GetTemplateThumbnailOptions = {
      id: string, // template id
    }
    

    Miscellaneous

    CREATE RESOURCE LINK

    This function creates a resource (report/image/theme) link to be stored in RDLX report definition. The Resource links are then resolved while rendering report. These links need to be correct for successful report preview.

    Parameters Return Value
    createResourceLink(options: ResourceLinkOptions) resourceLink: string

    RESOURCE LINK OPTIONS OBJECT

    Copy Code
    type ResourceLinkOptions = {
      id: string, // resource id
      type: 'report' | 'image' | 'theme' | null, // resource type
      version: null, // RESERVED - for now only null is supported
    }
    

    PARSE RESOURCE LINK

    The opposite operation to createResourceLink().

    Parameters Return Value
    parseResourceLink(resourceLink: string) ResourceLinkOptions

    UPDATE ROUTE

    This function can be used to update Designer url when a new or an existing report editing is started.

    Parameters Return Value
    updateRoute(options: UpdateRouteOptions) void

    UPDATE ROUTE OPTIONS OBJECT

    Copy Code
    type UpdateRouteOptions = {
      id: string, // report id
      version: null, // RESERVED - for now only null is supported
    }
    
    See Also