Create List from SQL
Audience:
Citizen Developer
Skill Prerequisites:
Using Form Builder
This action creates a list in the current context from the result of the provided SQL Query. You can find the number of loaded list items in the [<ListName>:Count]
token.
note
This creates an entity that can be used ONLY in the current context. This does not create a Plant an App Entity.
Typical Use Cases
- Load values from a SQL Query that returns a list of contacts and then send individual emails to that list.
- Load values from a SQL Query into an entity and then serialize that entity into CSV or Excel to provide the results in a file to the end-user.
Don't use it to
- Run a SQL query for any other reason than selecting records to create a contextual entity. For other SQL query scenarios, use the Run SQL Query action instead.
Related Actions
Action Name | Description |
---|---|
Execute Actions for each List Entry | Execute a list of actions on each item in the specified context list. Use this to process the items loaded in the list created. |
Extend Object Properties | Extends a list with new properties. |
Serialize to CSV | Serializes a list of entities from the context into CSV (Comma Separated Values) format. |
Serialize to Excel from entity list XSLX | Serializes a list of entities from the context into Excel format. |
Input Parameter Reference
The parameters unique to this action are listed below. Review the common parameters for all actions here.
Parameter | Description | Supports Tokens | Default | Required |
---|---|---|---|---|
Other Connection String | The connection string to the database. If left empty, the query will be executed on the main application database. You can connect to any database which supports the ODBC standard. For example, if you want to connect to an Oracle DB, you would specify Data Source=MyOracleDB;User Id=myUsername; Password=myPassword;Integrated Security=no; in the field. You can find out more about connection strings here. | Yes | Application database | No |
SQL Query | The SQL query you want to execute on the database. While the query does accept tokens, we recommend using the Bind Tokens parameter to avoid any potential SQL injection exploits. | Yes | Unset | Yes |
Bind Tokens | This parameter allows you to use tokens as variables in the SQL Query field to avoid SQL injection. For example, if you want to use the token [UserId] in your query, you would put the token in the Parameter Value field and give it a name in the Parameter Name field such as ID . After that, you can reference this variable as @ID inside the SQL Query Field. | Yes | Unset | No |
List Name | Provide a name for the list being created. This name can be used in the Execute Actions for each List Entry action to reference the items in the list using [ListName:PropertyName] token syntax. | Yes | empty string | Yes |
Properties | Map columns returned by the SQL to properties of the entity. If the list is empty, all columns retrieved from the SQL query will be added as entity properties. | Yes | None Specified | No |
On Error | Specify a list of actions to run on error. Otherwise, an error message is returned which will contain the underlying error if debug mode is on. | Yes | None Specified | No |