Insertions are additional calculations that can be inserted alongside the data-containing categories of a variable. Client applications are responsible for using the insertions defined on a variable to add to the results they display. You can use insertions to show subtotals of multiple categories (such as “Agree strongly” and “Agree somewhat”), as well as differences (such as “net agreement” subtracting Disagree categories from Agree categories).
An insertion is defined as an object with:
- function: A string defining the function. Currently only “subtotal” is supported.
- name: A string that will be displayed as the name of the inserted category.
- anchor: Either “top”, “bottom”, or a category ID that indicates which category the insertion should be placed after.
- args: An optional list of integers of the IDs that should be used as positive terms of the subtotal.
- kwargs: An optional object, with “positive”, which should be a duplication of the IDs in args, and “negative”, a list of category IDs that should be used as negative terms in a difference.