---
url: /v6.2/en-us/embed/app-param.md
---
# Using appParam to Pass Parameter Information

During the dashboard creation process, you can [control the display of dashboard content using parameters](../parameter-control.md). In embedded scenarios, you can use `appParam` to append parameter information to the URL. When the page is displayed, the parameter information in `appParam` will be included in the final executed SQL code, thereby displaying dashboard data under different parameter values.

### appParam Structure

`appParam` is an array that can contain multiple parameter objects. Each parameter object is an object with the following key-value pairs:

* `appId`: The ID of the data package or application that creates the parameter.
* `id`: The ID of the parameter, which can be obtained through a network request message.
* `name`: The name of the parameter.
* `value`: The value of the parameter, with a type consistent with the parameter type.
* `sig`: A boolean value indicating whether the parameter is included as part of the HMAC calculation. See [HMAC Signature Parameter Description](../security-policy-hmac.md).

Parameters can be specified using either `id` or `name`, so `appParam` supports the following two formats:

```json
{"appId": 1, "id": 1, "value": "Parameter Value"}
```

or

```json
{"appId": 1, "name": "Parameter Name", "value": "Parameter Value"}
```

### URL Splicing Format

The format for appending `appParam` to the embedded URL is as follows:

```
<EmbeddedURL>?appParam=[{"appId":1,"name":"Parameter Name","value":"Parameter Value"}]
```

> \[!IMPORTANT] Note
>
> * The format is `{url}?appParam={appParam}`.
> * The value of the `appParam` parameter needs to be passed after being processed with `JSON.stringify` and URL encoding, but the `appParam=` string itself does not need to be encoded.
> * You can use the [URL Encoding Tool](#URL-Encoding) below to conveniently generate the URL-encoded `appParam` parameter value and complete the URL splicing.

### appParam Usage Tips

1. **Parameter Identification**: In `appParam`, you can use either the parameter's `id` or `name` to identify the parameter. Only one of the two is required.
2. **appId Explanation**: The `appId` in `appParam` refers to the application ID where the parameter was created, not the application ID where the parameter is being used. For example, if a parameter is created in Dataset Market's data package A (with `appId` as 3) but is used in Application Creation's App A (with `appId` as 5), the `appId` to be entered in `appParam` should be 3.
3. **Importance of appId**: The `appId` and the parameter's `id` (or `name`) together determine the parameter. Omitting the `appId` may lead to incorrect results.
4. **Multi-Parameter Support**: `appParam` supports passing in multiple parameters.

## URL Encoding

## appParam Example

There are various ways to control the content display of a dashboard using parameters. Refer to the methods introduced in [Parameter Scenarios](../parameter-scenarios.md). Below, we use the example of using parameters in the [Dataset Chart Creation Process](../parameter-scenarios.md#dataset-chart-creation) to demonstrate how to pass parameters via appParam in an embedded scenario.

As shown in the figure, during the display of patient visit information in a hospital, the consultation room and attending doctor information are controlled using the department parameter. When the department parameter is changed, the chart information updates accordingly.

![](/images/solutions/solutions-embedded-analytics-001.png)

The URL of the dashboard is:

```
https://preview.hengshi.com/app/16743/dashboard/93
```

The dashboard content is as follows:

![](/images/solutions/solutions-embedded-analytics-002.png)

Both the department and region source parameters are [multi-value enabled fixed text list](../parameter.md#multi-value-parameters) parameters. The parameter configuration is as follows:

![](/images/solutions/solutions-embedded-analytics-007.png)

At this point, you can pass parameters via appParam to control the dashboard content display.

1. Scenario 1: Use appParam to pass the department parameter, displaying only the information for the Gastroenterology and Neurology departments. The appParam JSON structure is:

```json
[
  {
    "appId": 16743,
    "name": "Department",
    "value": [
      "Gastroenterology",
      "Neurology"
    ]
  }
]
```

Append the appParam to the URL as follows:

The dashboard displays as follows:

![](/images/solutions/solutions-embedded-analytics-003.png)

2. Scenario 2: Use appParam to pass multiple parameters, such as controlling department-related information via the department parameter and controlling patient region-related information via the region parameter. The appParam JSON structure is:

```json
[
  {
    "appId": 16743,
    "name": "Department",
    "value": [
      "Gastroenterology",
      "Neurology"
    ]
  },
  {
    "appId": 16743,
    "name": "Region Source",
    "value": [
      "Beijing",
      "Tianjin"
    ]
  }
]
```

The appended URL is:

The dashboard displays as follows:

![](/images/solutions/solutions-embedded-analytics-004.png)
