set_column_display
Set a column's display annotation to customize value rendering with number formats, boolean labels, and markdown patterns.
Instructions
Set the column-display annotation on a column.
Controls how a column's values are rendered, including custom formatting and markdown patterns.
Changes are staged locally until apply_annotations() is called.
Args: table_name: Name of the table containing the column. column_name: Name of the column. annotation: The column-display annotation value. Set to null/None to remove.
Column-Display Annotation Schema (tag:isrd.isi.edu,2016:column-display):
{
"*": { // Default for all contexts
"pre_format": {
"format": "%.2f", // printf-style format string
"bool_true_value": "Yes", // Display for true
"bool_false_value": "No" // Display for false
},
"markdown_pattern": "**{{{value}}}**", // Markdown template
"template_engine": "handlebars", // or "mustache"
"column_order": false // Disable sorting, or specify sort
},
"compact": {...}, // Compact/list view options
"detailed": {...}, // Detailed/record view options
"entry": {...}, // Entry form options
"entry/create": {...}, // Create form options
"entry/edit": {...} // Edit form options
}Available options:
pre_format: Pre-processing before displayformat: printf-style format (e.g., "%.2f" for 2 decimal places)bool_true_value: Text to show for boolean truebool_false_value: Text to show for boolean false
markdown_pattern: Template using {{{column_name}}} substitutiontemplate_engine: "handlebars" (default) or "mustache"column_order: Sort configuration or false to disable sorting
Template variables in markdown_pattern:
{{{_value}}}or{{{value}}}: The column's value{{{_row.column_name}}}: Another column's value from same row{{{$fkeys.schema.fkey.values.column}}}: Value from related table
Returns: JSON with status and the target column.
Examples: # Format numbers with 2 decimal places set_column_display("Measurement", "Value", { "*": {"pre_format": {"format": "%.2f"}} })
# Display boolean as Yes/No
set_column_display("Subject", "Active", {
"*": {
"pre_format": {
"bool_true_value": "Active",
"bool_false_value": "Inactive"
}
}
})
# Custom markdown pattern
set_column_display("Image", "URL", {
"detailed": {
"markdown_pattern": "[]({{{_value}}})"
}
})
# Disable column sorting
set_column_display("Subject", "Notes", {
"*": {"column_order": false}
})
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| annotation | No | ||
| table_name | Yes | ||
| column_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |