# 获取数据库数据

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

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

## 功能概要

* **输入结果的登录**是将i-Reporter协作到数据库。

<table><thead><tr><th>协作方向</th><th width="240.33333333333331">功能说明</th><th>执行时间</th></tr></thead><tbody><tr><td>数据库→i-Reporter协作</td><td>使用ConMas Gateway将数据库数据获取到i-Reporter报表的功能区中。</td><td>执行i-Reporter动作功能区</td></tr></tbody></table>

## 映射设置的步骤

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

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

* 单击**获取数据库数据**菜单添加新的映射。

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

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

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

<figure><img src="/files/6G2B3heZp25PIQQaOlga" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/FSx85QiiggExgqouRpkn" 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/573ZAYf7e0IdtlgTkxpT" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/F2lzVTEtBnMULlVRKc25" 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. 设置数据查询条件

* 设置搜索条件从数据库获取数据。 \
  根据获取的数据，通过ConMas Gateway将值输入到输入报表的功能区里。
* 指定i-Reporter的数据库字段和功能区。
* 设置搜索条件时需要确保只搜索一条记录。 \
  如果搜索多个记录，将导致自动制作报表失败。&#x20;

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

### 7. Gateway设置

* 请**下载ConMas Gateway的action文件或将action文件放置在Gateway服务器上**。 \
  如果要将action文件放置在Gateway服务器上的时候，请提前在**系统中配置“ConMas Gateway”设置**。
* 将Gateway的参数更新到相应的报表定义的动作功能区。 \
  **更新参数后报表定义的版本将上升**。

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

{% hint style="info" %}
**关于使用“放置到Gateway”按钮的ConMas Gateway的Config文件设置**

需要使用ConMas Gateway 2.1.230200 及以上版本。 \
请修改ConMas Gateway的配置文件。 \
配置文件的默认位置：C:\ConMas\gateway\Config\Default .json \
用记事本等打开配置文件，并添加下面末尾描述的“runMode”设置。

**default.json 文件设置**

```json
{
  "port": 3000,
  "ssl": false,
  "sslkey": "./ssl/cert.key",
  "sslcert": "./ssl/cert.pem",
  "authType": "default",
  "token": "令牌",
  "pythonShell": {
    "mode": "text",
    "encoding": "utf8",
    "pythonOptions": ["-X", "utf8"]
  },
  "uploadFileTypes": {
    "binary": "bmp;gif;jpg;tif;png;wav",
    "text": ""
  },
  "customMaster": {
    "limit": 500
  }
  添加以下内容（在开头加逗号）
  ,
    "runMode": {
    "maintenance": true
  }
  以上
}
```

{% endhint %}


---

# 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/huo-qu-shu-ju-ku-shu-ju.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.
