Export Records to Knack
Overview
This documentation describes how to use the "Export Records to Knack" pipeline, which enables the export of data from your system to a Knack database. This connector is designed to synchronize data between your application and Knack, ensuring that records are kept up-to-date in both systems.
Pipeline Parameters
Knack Object Key
- Type: String
- Description: The Object Key corresponds to the specific database object (like a table) in Knack from which data will be imported.
- How to Find: In the Knack application, navigate to the table you want to import data from. The Object Key can be found in the URL after
/objects/
.
Knack Filter for Duplicate Check
Type: JSON
Description: A JSON object defining the criteria used to check for duplicates before exporting data to Knack.
Configuration: The "Knack filter for duplicate check" is used to match records between the source entity and the target table in a Knack App. This utilizes the Knack Filter API, which is detailed at Knack's filter documentation.
Detail guide
Here is a basic example of how to construct such a filter:{
"match": "and",
"rules": [
{
"field": "field_1", // ID of the field in the Knack table
"operator": "is",
"value": data.field_1 // Field from the source Entity
}
]
}PS: Don't forget to delete comments before using the JSON object.
In this example, the filter is set up to ensure that the value in
field_1
of the Knack table matches thefield_1
from the source entity.If a unique identifier is composite, meaning it consists of multiple fields, you'll need to extend your filter to include each component of the identifier. In Knack, this is achieved by adding multiple rules to the filter, each specifying a part of the composite key. Each rule will compare a specific field in the target table to a corresponding field in the source entity.
Here's an example of how to construct a filter with a composite unique identifier using the Knack Filter API:
{
"match": "and",
"rules": [
{
"field": "field_1", // ID of the first part of the composite key in the Knack table
"operator": "is",
"value": data.field_1 // First part of the composite key from the source Entity
},
{
"field": "field_2", // ID of the second part of the composite key in the Knack table
"operator": "is",
"value": data.field_2 // Second part of the composite key from the source Entity
},
// Add more rules as needed for additional parts of the composite key
]
}When dealing with fields that are objects rather than literals for synchronization in Knack, and you require a full match between the object in the source entity and the object in the Knack table, you should use the
full
modifier in thevalue
field of the filter. This ensures that the comparison checks for a complete match of the entire object structure and content, rather than just matching a simple literal value.Here is how you would modify the filter setup in the Knack Filter API to accommodate an object-based field requiring a full match:
{
"match": "and",
"rules": [
{
"field": "field_1", // ID of the field in the Knack table
"operator": "is",
"value": data.field_1.full
}
]
}
Source Entity Settings
Source Entity
- Type: Entity
- Description: Specifies the entity in your system from which data will be exported.
- Selection: Choose the appropriate entity from the dropdown menu in the pipeline configuration.
Source Entity Filter
- Type: JSON
- Description: Defines conditions under which records are selected for export.
- Configuration: Enter a Mongo query JSON object that specifies filtering rules.
Source Entity Mapping
- Type: JSONata
- Description: Maps fields from your source entity to the corresponding fields in the Knack object.
- Example Configuration: Provide a JSONata object that pairs knack field ids with source entity fields.
{
"field_1": data.field_1,
"field_2": data.field_2,
"field_3": data.field_3
}
- Note: JSONata syntax it's not the same as JSON. JSONata is a query and transformation language for JSON data. You can learn more about JSONata here.