Swallow
  • YOUR FIRST MODEL
    • Setting up your first project
    • Manual setup of a new product
    • Excel Model Upload
    • Create your team
    • Essential concepts
      • Syntax
      • Steps
      • Collections
      • Try Model
      • Spotlight
  • PROCESS
    • Team Management
    • Governance & Collaboration
  • BUILD
    • Building with AI
    • Step builder
      • Understanding step types
      • Ordering step blocks
      • Placeholder mode
      • Up/Downloading models
      • Sharing your model
      • Running tests
    • Inputs
    • Enriching Raw Data
      • Transform Data
      • Enrich via API
      • Data Set
      • Collection
      • Custom Code
    • Setting Up Decisions
      • Exclusions
      • Excesses
      • Endorsements
      • Refer
    • Making Calculations
      • Factors
      • Calculation
    • Outputs
  • TEST
    • Creating New Tests
    • Running Tests
    • Editing Tests
    • Reading & Interpreting Tests
    • Impact Testing
  • DATA
    • Working with real-time data
    • Data Views
    • Data Quotas
    • Troubleshooting
    • API Webhooks
    • Data Downloads
  • ADMIN & SETTINGS
    • Project Management
    • Account Management
  • INTEGRATIONS
    • Introduction
    • Payments
      • Stripe
      • GoCardless
      • Adyen
    • Alerting
      • Slack
      • Zapier
    • Data
      • AWS S3
      • Google Sheets
    • Admin
      • Socotra
      • Guidewire
      • Hubspot
      • Salesforce
  • Developer API
    • Introduction
    • Authentication
    • Errors codes
    • Endpoints
      • /quotes
      • /projects
      • /tests
      • /process
Powered by GitBook
On this page
  • 1. Add the dataset you want to query
  • 2. Set up your queries
  • Label
  • Output Key
  • Type
  • Expression
  • Default Value
  • 4. Save your new variable
  • 5. Save the step
  1. BUILD
  2. Enriching Raw Data

Collection

Using the Collection step in the builder to dynamically query data tables with multiple columns to enrich your input data

PreviousData SetNextCustom Code

Last updated 1 year ago

A 'Collection' is a data table that you can use to create custom outputs. In this step, you can upload data that you want to use your enrich your data.

Collections can be many megabytes in size and you can define hundreds of formats.

If you just want to upload a small table and save all of the columns contained in it against your key, you may find the Data Set step is a simpler and faster way to do this.

How might you use the 'Collection' step?

If you were building a pricing model for insurance, the address where the property is located would play a vital part in your pricing decisions.

By uploading a whole database of risk ratings for a number of different factors, you could use the 'Collection' step to query this table and enrich each quote with different risk scores, cherry picking the data you wanted to add to your quote, without having to add all of it.

1. Add the dataset you want to query

To get started, click the cog symbol in the top right of the 'Collections' step.

Once you've opened the step, click the 'Add Data' button.

You can then copy a data table and paste it directly into Swallow, or you can drag-and-drop a CSV document, which will upload immediately.

It's worth noting that you can also use the 'Download' and 'Upload' buttons to download your Collection as a CSV and do bulk reformatting or editing of your tables if you want to.

2. Set up your queries

Once your data is successfully uploaded, you'll see your full table, including header rows, is uploaded into Swallow.

For each variable you want to return from querying the table, simply click the 'Add' button at the top right of the table to begin the process, and complete the fields below.

Label

This labels the new variable you're storing. Keep the description short and simple so you can recognise it easily in future steps.

Output Key

This is output name that will be passed to the next step, and how you'll reference the input in any syntax in future steps.

This will be auto-generated based on the label you've given, but you can edit it at any time.

Type

This the data type of the data you want to transform the input into.

You can choose from 5 data types: Boolean, Decimal, Integer, String or Date.

Expression

Collection expressions are structured in a different format to other syntax, and must begin with the prefix collection. before the rest of your expression.

To learn more about how to structure expressions for querying Collections, find out how to debug and to see the full glossary, check out our full page on Syntax and Collections.

Default Value

This is the default value you want to set.

This is the data the model will default to if the value is not defined by the customer or the transformation fails for any reason.

4. Save your new variable

Once you're happy with the settings of the variable you've added from your Collection, just press the 'Save' button in the bottom right of the modal and you're ready to add more variables to the table from your Collection if you want to.

5. Save the step

Once you're happy with all of your variables, just press the 'Save' button in the top right of the screen. You're now ready to head back to the 'Build' screen.

Once you've added the 'Collections' step and named it, like you will with any other step in the Build tool (), you'll need to add the database you want to query.

more on that here
The Collection step
The 'Add Data' button
ADD button for new query
Save variable button
Save step button