添加数据源和数据集选项
获取数据集属性选项
设计器服务器API对象
baseServerApi.js模块包含Web设计器操作所需的某些功能,这些功能与报表,数据,主题,图像和报表模板有关。 这些功能描述如下。 有关更多信息,请参见Web Designer API。
注意:某些属性和功能被标记为“保留”,因为它们在ActiveReports 14中不相关(例如,报告修订),但是为了使Web Designer正常工作,仍需要它们。 Web Designer不仅在ActiveReports 14中使用,还在ActiveReports Server中的旧版本中使用。 |
---|
报表
获取报表列表
参数 | 返回值 | 响应模型 |
---|---|---|
getReportsList() | Promise | Array<ReportsListItem> |
报表清单项目对象
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
}
获取报表内容
参数 | 返回值 | 响应模型 |
---|---|---|
getReportContent(options: GetReportContentOptions) | Promise | Report JSON Model |
获取报表内容选项对象
type GetReportContentOptions {
id: string, // report id
version: null, // RESERVED - for now only null is supported
}
获取报表修订-保留
参数 | 返回值 | 响应模型 |
---|---|---|
getReportRevisions(options: GetReportRevisionsOptions) | Promise | Array<ReportRevision> |
报表修的对象
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
}
保存新报表
参数 | 返回值 | 响应模型 |
---|---|---|
saveNewReport(options: SaveNewReportOptions) | Promise | SaveReportResponse |
保存新的报表选项对象
type SaveNewReportOptions = {
name: string, // report name
content: object, // report JSON model
}
保存报表响应对象
type SaveReportResponse = {
Id: string, // saved report id
}
保存现有报表
参数 | 返回值 | 响应模型 |
---|---|---|
saveExistingReport(options: SaveExistingReportOptions) | Promise | SaveReportResponse |
保存现有报表选项对象
type SaveExistingReportOptions = {
id: string, // report id
content: object, // report JSON model
}
保存临时报表
参数 | 返回值 | 响应模型 |
---|---|---|
saveTemporaryReport(options: SaveTemporaryReportOptions) | Promise | SaveReportResponse |
保存临时报表选项对象
type SaveTemporaryReportOptions = {
name: string, // report name
content: object, // report JSON model
}
删除临时报表
这是在Designer之外使用的可选服务功能。 关闭报表查看器并将视图切换回Designer时,可用于删除临时报表。
参数 | 返回值 | 响应模型 |
---|---|---|
deleteTemporaryReport(options: DeleteTemporaryReportOptions) | Promise | DeleteReportResponse |
删除临时报表对象
type DeleteTemporaryReportOptions = {
id: string, // report id
}
删除报表响应对象
type DeleteReportResponse = {
Id: string, // deleted report id
}
数据
获取数据集列表
参数 | 返回值 | 响应模型 |
---|---|---|
getDataSetsList() | Promise | Array<DataSetsListItem> |
数据集列表项目对象
type DataSetsListItem = {
id: string, // data set id
name: string, // data set name
version: null, // RESERVED - for now only null is supported
}
获取数据源和数据集
参数 | 返回值 | 响应模型 |
---|---|---|
getDataSourcesAndDataSets(options: GetDataSourcesAndDataSetsOptions) | Promise | GetDataSourcesAndDataSetsResponse |
是否可以编辑数据源
参数 | 返回值 | 响应模型 |
---|---|---|
canEditDataSource(options: CanEditDataSourceOptions) | Promise | GetDataSourcesAndDataSetsResponse |
获取CANEDITDATASOURCE选项对象
type CanEditDataSourceOptions = {
/** data source */
dataSource: DataSource;
/** data provider of data source */
dataProvider: string;
};
是否可以为特定的数据源创建数据集
参数 | 返回值 | 响应模型 |
---|---|---|
canAddDataSetForDataSource(options: CanAddDataSetForDataSourceOptions)) | Promise | GetDataSourcesAndDataSetsResponse |
获取CANADDDATASETFORDATASOURCE选项对象
type CanAddDataSetForDataSourceOptions = {
/** data source */
dataSource: DataSource;
/** data provider of data source */
dataProvider: string;
};
是否可以编辑数据集
参数 | 返回值 | 响应模型 |
---|---|---|
canEditDataSet:(options: CanEditDataSetOptions) | Promise | GetDataSourcesAndDataSetsResponse |
获取EDITDATASET OPTIONS对象
type CanEditDataSetOptions = {
/** data set */
dataSet: DataSet;
/** data provider of data set's parent data source */
dataProvider: string;
};
返回为特定数据源初始化的数据集
参数 | 返回值 | 响应模型 |
---|---|---|
initDataSetForDataSource:(options: InitDataSetForDataSourceOptions) | Promise | GetDataSourcesAndDataSetsResponse |
GET INITDATASETFORDATASOURCE选项对象
type InitDataSetForDataSourceOptions = {
/** data source */
dataSource: DataSource;
/** data provider of data source */
dataProvider: string;
/** data set name to be initialized */
dataSetName: string;
};
获取可用于特定数据集的属性
参数 | 返回值 | 响应模型 |
---|---|---|
getDataSetProperties:(options: GetDataSetPropertiesOptions) | Promise | GetDataSourcesAndDataSetsResponse |
获取GETDATASETPROPERTIES选项对象
type GetDataSetPropertiesOptions = {
/** data provider of data set's parent data source */
dataProvider: string;
};
获取GETDATASETPROPERTIES响应对象
type DataSetProperty = 'name' | 'commandType' | 'query' | 'fields' | 'calculatedFields' | 'parameters' | 'filters' | 'caseSensitivity' | 'collation' | 'kanatypeSensitivity' | 'widthSensitivity' | 'accentSensitivity';
获取特定数据集的架构
参数 | 返回值 | 响应模型 |
---|---|---|
getDataSetSchema(options: GetDataSetSchemaOptions) | Promise | GetDataSourcesAndDataSetsResponse |
获取GETDATASETSCHEMA选项对象
type GetDataSetSchemaOptions = {
/** data set */
dataSet: DataSet;
/** data set's parent data source */
dataSource: DataSource;
};
获取GETDATASETSCHEMA响应对象
type GetDataSetSchemaResponse = {
/** data set fields */
fields: Array<Field>;
/** data set query parameters */
parameters: Array<QueryParameter>;
};
获取数据源和数据集
参数 | 返回值 | 响应模型 |
---|---|---|
getDataSourcesAndDataSets(options: GetDataSourcesAndDataSetsOptions) | Promise | GetDataSourcesAndDataSetsResponse |
获取数据源和数据集选项对象
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
}
获取数据源和数据集响应对象
type GetDataSourcesAndDataSetsResponse = {
dataSources: Array<DataSource>,
dataSets: Array<DataSet>,
}
****
获取数据集内容
此函数旨在在getDataSourcesAndDataSets()中使用。 结果dataSetContent对象可以存储创建数据集及其父数据源所需的信息。
参数 | 返回值 | 响应模型 |
---|---|---|
getDataSetContent(options: GetDataSetContentOptions) | Promise | dataSetContent: object |
获取数据集内容选项对象
type GetDataSetContentOptions = {
id: string, // data set id
}
数据源和数据集对象
列出了DataSource和DataSet类型的基本属性。 DataSource和DataSet的对象模型与其在RDLX报告定义中的结构相关。
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
}
开放数据源编辑器的实现
/* Optional: Add/Edit Data Sources using Data Source Editor */
var openDataSourceEditorImpl = function (options) {
ARDataSourceEditor.open(makeOptions(options, {
serverApi: {
testConnection: baseServerApi.testDataSourceConnection,
},
}));
};
可以编辑数据源选项
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;
};
数据源选项的初始化数据集
export type InitDataSetForDataSourceOptions = {
/** data source */
dataSource: DataSource;
/** data provider of data source */
dataProvider: string;
/** data set name to be initialized */
dataSetName: string;
};
获取数据集属性选项
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';
获取数据集架构选项
export type GetDataSetSchemaOptions = {
/** data set */
dataSet: DataSet;
/** data set's parent data source */
dataSource: DataSource;
};
获取数据集架构响应
export type GetDataSetSchemaResponse = {
/** data set fields */
fields: Array;
/** data set query parameters */
parameters: Array;
};
开放数据源编辑器基础选项
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;
};
开放数据源编辑器基础选项
export type DataSourceEditorOnSuccessOptions = {
/** successfully created or edited data source */
dataSource: DataSource;
};
开放数据集选择器基础选项
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;
};
数据设置拣选模式
export type DataSetPickerMode = 'Panel' | 'Dialog';
添加数据源和数据集选项
export type AddDataSourcesAndDataSetsOptions = {
/** data sources to-be-added */
dataSources: Array;
/** data sets to-be-added */
dataSets: Array;
};
可以为数据源选项添加数据集
export type CanAddDataSetForDataSourceOptions = {
/** data source */
dataSource: DataSource;
/** data provider of data source */
dataProvider: string;
};
数据源编辑器API
/**
* 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;
数据源编辑器服务器API
/** **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,
};
主题
获取主题列表
参数 | 返回值 | 响应模型 |
---|---|---|
getDataSetContent(options: GetDataSetContentOptions) | Promise | dataSetContent: object |
主题列表项目对象
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
}
主题列表项目对象
参数 | 返回值 | 响应模型 |
---|---|---|
getThemeContent(options: GetThemeContentOptions) | Promise | ThemeModel |
获取主题内容选项对象
type GetThemeContentOptions = {
id: string, // theme id
}
主题模型对象
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
}
图像
获取图像列表
参数 | 返回值 | 响应模型 |
---|---|---|
getImagesList() | Promise | Array<ImagesListItem> |
图像列表项目对象
type ImagesListItem = {
_id: string, // image id
Name: string, // image name
MimeType: string, // image MIME type
Thumbnail: null, // RESERVED - for now only null is supported
}
获取图像URL
该URL用于在设计时显示外部图像。
参数 | 返回值 | 响应模型 |
---|---|---|
getTemplatesList() | Promise | Array<ImagesListItem> |
获取图像URL选项对象
type GetImageUrlOptions = {
id: string, // image id
}
获取模板缩略图
此功能可以在某些自定义“文件视图”实现中使用。
参数 | 返回值 | 响应模型 |
---|---|---|
getTemplateContent(options: GetTemplateContentOptions) | Promise | Report JSON Model |
type GetTemplateContentOptions = {
id: string, // template id
}
获取模板缩略图
此功能可以在某些自定义“文件视图”实现中使用。
参数 | 返回值 | 响应模型 |
---|---|---|
getTemplateThumbnail(options: GetTemplateThumbnailOptions) | Promise | base64ImageData: string |
获取模板缩略图选项对象
type GetTemplateThumbnailOptions = {
id: string, // template id
}
创建资源链接
此函数创建资源(报告/图像/主题)链接以存储在RDLX报告定义中。 然后在渲染报告时解析资源链接。 这些链接必须正确才能成功预览报告。
参数 | 返回值 |
---|---|
createResourceLink(options: ResourceLinkOptions) | Promise |
资源链接选项对象
type ResourceLinkOptions = {
id: string, // resource id
type: 'report' | 'image' | 'theme' | null, // resource type
version: null, // RESERVED - for now only null is supported
}
PARSE资源链接
与createResourceLink()相反的操作。
参数 | 返回值 |
---|---|
parseResourceLink(resourceLink: string) | ResourceLinkOptions |
更新路线
当开始新的或现有的报告编辑时,此功能可用于更新Designer URL。
参数 | 返回值 |
---|---|
updateRoute(options: UpdateRouteOptions) | void |
更新路线选项对象
type UpdateRouteOptions = {
id: string, // report id
version: null, // RESERVED - for now only null is supported
}
相关资源:
注意
如需寻求在线帮助,请访问 ActiveReports 求助中心
如需了解更多ActiveReports产品特性,请访问 ActiveReports 官方网站
ActiveReports 官方技术交流群:109783140
下载产品体验产品功能:http://www.gcpowertools.com.cn/products/download.aspx?pid=16