Field Formatting

Field Formatting

Overview

All scalar fields in the Finale GraphQL API support the formatter argument, which controls how field values are returned. This allows you to choose between HTML-formatted output (with links and formatting), raw values, abbreviated versions, or other formatting options.

Universal Support

Important: The formatter argument is available on all scalar fields, regardless of their type or default formatting behavior. This is a universal feature of the API.

Formatter Options

Every scalar field accepts these formatter values:

"html"

Returns HTML-formatted content with links and escaped text. This is useful for display in web interfaces.

Example:

query {
  productViewConnection(first: 5) {
    edges {
      node {
        productId(formatter: "html")
        sku(formatter: "html")
      }
    }
  }
}

Use when:

"none"

Returns the raw, unformatted value exactly as stored in the database.

Example:

query {
  productViewConnection(first: 5) {
    edges {
      node {
        productId(formatter: "none")
        price(formatter: "none")
      }
    }
  }
}

Use when:

"abbreviated"

Returns an abbreviated or shortened version of the formatted value.

Example:

query {
  productViewConnection(first: 5) {
    edges {
      node {
        description(formatter: "abbreviated")
        notes(formatter: "abbreviated")
      }
    }
  }
}

Use when:

"blank-zero"

Returns an empty string if the value is zero, otherwise returns the formatted value.

Example:

query {
  productViewConnection(first: 5) {
    edges {
      node {
        quantityOnHand(formatter: "blank-zero")
        price(formatter: "blank-zero")
      }
    }
  }
}

Use when:

Default Formatter

When no formatter argument is specified, the API uses the field's default formatting behavior:

You can check each field's default formatter in its documentation under "Default Formatter" in the reference pages.

Usage Patterns

Field-Level Formatting

Apply formatting to individual fields:

query {
  orderViewConnection(first: 10) {
    edges {
      node {
        orderId(formatter: "html")      # HTML formatted
        orderDate(formatter: "none")     # Raw value
        total(formatter: "blank-zero")   # Empty if zero
        description                      # Default formatting
      }
    }
  }
}

Node-Level Formatting

Apply the same formatter to all fields in a node:

query {
  productViewConnection(first: 10) {
    edges {
      node(formatter: "html") {
        productId    # All fields use HTML formatting
        sku
        name
        description
      }
    }
  }
}

Note: Field-level formatters override node-level formatters.

Mixing Formatters

Combine node-level and field-level formatters for fine-grained control:

query {
  orderViewConnection(first: 10) {
    edges {
      node(formatter: "html") {
        orderId                    # Uses node-level "html"
        orderDate(formatter: "none")  # Overrides to "none"
        customerId                 # Uses node-level "html"
        total(formatter: "blank-zero")  # Overrides to "blank-zero"
      }
    }
  }
}

Default Formatter Behavior

Some fields have a default formatter defined (usually "html"). When a field has a default formatter:

Example with field that defaults to HTML:

query {
  productViewConnection(first: 5) {
    edges {
      node {
        productId                    # Uses default (html)
        productId(formatter: "none")  # Gets raw value
        sku                          # Uses default (standard)
      }
    }
  }
}

Best Practices

  1. Use "none" for integrations: When building integrations or exports, use formatter: "none" to get exact values without formatting
  2. Use "html" for web display: When displaying data in a web UI, use formatter: "html" for properly formatted and linked content
  3. Check default formatters: Review field documentation to understand default formatting behavior
  4. Be explicit in production: Always specify formatters explicitly in production code to avoid surprises if defaults change
  5. Consider performance: The "none" formatter is typically fastest since it skips formatting logic

Common Use Cases

Data Export

query {
  productViewConnection(first: 1000) {
    edges {
      node(formatter: "none") {
        productId
        sku
        name
        price
        quantityOnHand
      }
    }
  }
}

Web UI Display

query {
  orderViewConnection(first: 50) {
    edges {
      node(formatter: "html") {
        orderId
        orderDate
        customerName
        total
        status
      }
    }
  }
}

Report Generation

query {
  productViewConnection(first: 100) {
    edges {
      node {
        productId(formatter: "html")
        sku(formatter: "none")
        quantityOnHand(formatter: "blank-zero")
        description(formatter: "abbreviated")
      }
    }
  }
}

Technical Details

Implementation

The formatter argument is:

Performance Considerations

For large queries, consider using "none" and applying formatting client-side if needed.

Next Steps

Updated 9 months ago