# 自动制作报表

<div align="left"><figure><img src="/files/ejBZZeDrq5sOKCU38C1E" alt=""><figcaption></figcaption></figure></div>

下面描述中使用的图片是PostgreSQL协作的图片。 \
其他数据库协作具有相同的画面结构。

## 功能概要

* **自动制作报表**是将数据库协作到 i-Reporter。

<table><thead><tr><th width="225">协作方向</th><th width="214.33333333333331">功能说明</th><th>执行时间</th></tr></thead><tbody><tr><td>数据库→i-Reporter协作</td><td>根据数据库数据自动制作i-Reporter报表。</td><td>从外部系统调用i-Repo Link的映射设置生成的API（Webhook）。</td></tr></tbody></table>

## 映射设置的步骤

按照下面的步骤设置映射。

### 1. 选择数据库协作模式

* 通过点击**自动制作报表**菜单来新添加映射。

<figure><img src="/files/YDYMTTT5frgEu2ynFO0I" alt=""><figcaption></figcaption></figure>

### 2. 设置映射编码/映射名称

* 设置**映射编码**和**映射名称**。
* 映射编码是**唯一标识 i-Repo Link 环境中所有映射配置的密钥**。

<figure><img src="/files/PMJYeeeK4Fvei2MeZgg8" alt=""><figcaption></figcaption></figure>

### 3. 选择协作源的数据源和表/视图

* 选择数据库**数据源**和**表或视图**作为协作源。

<figure><img src="/files/wKSGsSpHWnWrR44ZyzZW" alt=""><figcaption></figcaption></figure>

* 请参考下面的页面来添加和配置数据源。

{% content-ref url="/pages/Mr8iIh9WBLvgsGDHpX6I" %}
[数据源](/i-repo-link-manual/chinese/system/2/1.md)
{% endcontent-ref %}

### 4. 选择协作目标的i-Reporter报表定义

<figure><img src="/files/PuK4IEBDbIyAlCiiY1U4" alt=""><figcaption></figcaption></figure>

### 5. 映射i-Reporter报表定义的数据库字段和功能区

* 界面左侧显示数据库信息，右侧显示i-Reporter报表信息。
* 如果数据库中的字段是浅灰色的，则表示不能协作的字段。
* 如果不能映射，则返回错误提示。

<figure><img src="/files/tmYpCd7SSDQrmO2w2GH9" alt=""><figcaption></figcaption></figure>

* 有关可以映射的字段和功能区的组合，请参阅以下页面。

{% content-ref url="/pages/mMzeI1y9tZxAQ6Y8IOEk" %}
[PostgreSQL与i-Reporter协作项映射表](/i-repo-link-manual/chinese/shu-ju-yuan-xie-zuo-suo-you-shu-ju-ku-gong-tong/gong-tong/postgresql-yu-ireporter-xie-zuo-xiang-ying-she-biao.md)
{% endcontent-ref %}

{% content-ref url="/pages/CXbUQjSVzaCpFKwJ5XjC" %}
[Oracle与i-Reporter协作项映射表](/i-repo-link-manual/chinese/shu-ju-yuan-xie-zuo-suo-you-shu-ju-ku-gong-tong/gong-tong/oracle-yu-ireporter-xie-zuo-xiang-ying-she-biao.md)
{% endcontent-ref %}

### 6. 设置数据查询条件

* 设置搜索条件从数据库获取数据。 \
  根据搜索的数据自动制作报表。
* 设置搜索条件时需要确保只搜索一条记录。 \
  如果搜索多个记录，将导致自动制作报表失败。
* 可以指定一个固定值和API参数（查询参数）作为查询条件。 \
  最多可以指定10个API参数。 \
  参数名的取值范围为param1 \~ 10。（固定值不需要指定为API参数。）

<figure><img src="/files/b40A1eC9lB180yD8Aa6d" alt=""><figcaption></figcaption></figure>

### 7. 设置Webhook URL

i-Reporter设置的Webhook URL

* i-Reporter设置的Webhook URL会生成一个API，当外部系统执行自动制作报表时调用该API。
* 当使用API参数（查询参数）时，在Webhook URL的末尾中指定。\
  API参数在“？”后边以“param1=\[value]”的格式添加。API参数之间用“&”连接。\
  示例：在API参数1中指定了ABC，在API参数2中指定了123\
  \[HTTP or HTTPS]://\[domain]/i-RepoLink/API/mappings/\[mapping code]/autoGenerate? **param1=ABC\&param2=123**

<figure><img src="/files/gBG3EFALapNySMJff5Jn" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cimtops.gitbook.io/i-repo-link-manual/chinese/cai-dan/zi-dong-zhi-zuo-bao-biao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
