<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Application Templates](#application-templates)
- [Creating a Copy](#creating-a-copy)
- [Creating a New Application Using a Template](#creating-a-new-application-using-a-template)
- [Exporting Templates](#exporting-templates)
- [Importing Templates](#importing-templates)
- [Replacing Datasets](#replacing-datasets)
- [Replacing Data Connections](#replacing-data-connections)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Application Templates
Application templates enable the reuse and continuous improvement of analytical results.
- Support for application copy functionality
Users can link existing analytical results to new analytical needs and quickly complete modifications.
- Support for creating applications as templates after application publishing
The combination of application publishing and templates allows all operational personnel within the enterprise to proficiently use high-value analytical models.
- Support for exporting applications as templates
Facilitate the convenient exchange of analytical models between multiple users.
- Support the functionality of replacing data within the application and replacing data connections
Users can flexibly use existing analytical models in different data environments.
### Creating a Copy
In the application composition area, click on the application menu, select `Create a Copy`, which will create a copy in the application composition area.

- When sorting by "Update Time" or "Add Time" in ascending order in the application composition, the created copy will be displayed first.
If sorting by "Update Time" or "Add Time" in descending order, the copy will be displayed last.
The naming convention for the copy is: "Original Application Name (1)", and users can customize the name of the copy.
- Opening an Application Copy
If you create a copy of someone else's collaborative application, the local file dataset will be empty, with no data, and can only be made available through replacing datasets.
Directly connected datasets and SQL query datasets will display corresponding data according to the current user's permissions on the data connection.
- Users can create datasets, process data, and construct charts and tables within the created copy to achieve targeted analytical needs.
### Creating a New Application Using a Template
- In application composition
When publishing an application, select `Export Application Template` for publishing.

- In the application marketplace
The just-published application menu will have two additional options: `Create New Application Using Template` and `Export Template`, which can be seen by users who can view that application.
"Create New Application Using Template" is detailed in [Creating a New Application Using Template](app-analyst-market.md#creating-a-new-application-using-a-template).

### Exporting Templates
Click on `Export Template` to export an application template file in JSON format.

### Importing Templates
In the application composition area, click `Create New Application` -> `Import Template`. In the file dialog that pops up, select the exported template, and an application will be created in the composition area.
- In ascending order by "Update Time" or "Add Time", the imported template will be displayed first in the application composition.
If sorting in descending order, the imported template will be displayed last.
The naming convention for the imported template is: "Exported Template Name (1)", and users can customize the name of the imported template.
- Opening the Imported Template
The local file dataset will be empty, with no data, and can only be made available through replacing datasets.
Directly connected datasets and SQL query datasets will display corresponding data according to the current user's permissions on the data connection.
In the data model, if direct connections and SQL query datasets have established relationships (join/union/aggregate) in the exported template, those relationships will remain in the imported template, and its charts can still use them for plotting; if relationships were established between local file datasets in the exported template, those relationships will still be there in the imported template, but charts using that associated model will have no data.
- Users can create datasets, process data, and construct charts and tables within the imported template to achieve targeted analytical needs.

### Replacing Datasets
After creating an application using a template, the local file dataset will be emptied, and other datasets might be inaccessible due to permission or environment issues.
Local file datasets can only be made available through `Replace Dataset`, and datasets connected to databases can be made available via both `Replace Dataset` and `Replace Data Connection`.
Replacing datasets is detailed in [Replacing Dataset](replace-dataset.md).
### Replacing Data Connections
In the application composition area, click on the `Replace Data Connection` in the application menu to replace a specific connection or all connections for the application.
Replacing data connections is often equivalent to migrating applications between test and production environments.


In the "Replace Data Connection" dropdown, select the data connection to replace. The replacement and original data connections must meet the following conditions for successful replacement:
- The table paths must be identical, for example, test.A_IVT_MOVIE.
- The field names of the tables must be identical.
- The field types of the tables must be compatible.
In the image below, the paths do not match, so the replacement fails:

In the image below, there are missing fields, so the replacement fails:

If the directory matches and the table field names match, the match will be successful.

