Table kit command

table.views.putFilterTree

Set a view's filter

Replaces a view's filter conditions with a tree of and/or groups of field conditions.

Kit
Table 0.4.0 (.ktable)
Changes the document
yes

Parameters

Parameters of table.views.putFilterTree
NameTypeRequiredDescription
asOriginstringnosystem:<name> writes as a host feature, outside the undo history. Agents leave it out.
tableIdinteger | stringyesThe table's id.
treeobjectno
viewIdinteger | stringyesThe view's id.

Call through table_run

text
table_run {
  "path": "<file>.ktable",
  "steps": [{ "command": "table.views.putFilterTree", "params": { "tableId": <integer | string>, "viewId": <integer | string> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: asOrigin, tree. table_run answers the step’s result in completed[i].result.

Result

Result of table.views.putFilterTree
NameTypeRequiredDescription
changeobject | nullnoWhat the call changed, or null.
errorobjectnoWhy the call failed (A18); the file is as it was.
resultobjectnoThe view's filter.
Result JSON Schema
json
{
  "additionalProperties": false,
  "description": "The request's own answer is in `result`, beside `change`: what the call changed in the document (null when nothing changed). A failed call answers `error` instead (A18).",
  "properties": {
    "change": {
      "description": "What the call changed, or null.",
      "oneOf": [
        {
          "additionalProperties": false,
          "description": "What one projection changed in the relational tables, by integer id. Every list is sorted and\nholds no repeats.",
          "properties": {
            "dashboards": {
              "description": "A dashboard, or the base's list of them, changed.",
              "type": "boolean"
            },
            "documentId": {
              "type": "string"
            },
            "origin": {
              "description": "Who wrote it: kind:principal, or a system origin's label.",
              "type": "string"
            },
            "recordsDeleted": {
              "description": "[tableId, rowKey] pairs.",
              "items": {
                "items": {},
                "type": "array"
              },
              "type": "array"
            },
            "recordsReordered": {
              "description": "Tables whose records' positions changed.",
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            "recordsUpserted": {
              "description": "[tableId, rowKey] pairs.",
              "items": {
                "items": {},
                "type": "array"
              },
              "type": "array"
            },
            "schema": {
              "description": "Tables whose fields were added, removed, updated, or reordered.",
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            "tables": {
              "description": "Tables whose own row changed: created, deleted, renamed, moved, or given a new primary\nfield.",
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            "views": {
              "description": "Views created, deleted, updated, or reordered, or whose column widths or visibility\nchanged.",
              "items": {
                "type": "integer"
              },
              "type": "array"
            }
          },
          "required": [
            "tables",
            "schema",
            "views",
            "recordsReordered",
            "dashboards"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "additionalProperties": false,
      "description": "Why the call failed (A18); the file is as it was.",
      "properties": {
        "code": {
          "enum": [
            "invalid-params",
            "invalid-op",
            "invalid-value",
            "not-found",
            "read-only",
            "unknown-command",
            "command-failed",
            "not-open",
            "draft-required",
            "not-allowed",
            "unsupported",
            "unavailable",
            "failed"
          ],
          "type": "string"
        },
        "index": {
          "description": "The failing step or operation.",
          "type": "integer"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "result": {
      "additionalProperties": true,
      "description": "The view's filter.",
      "properties": {
        "tree": {
          "description": "A group of conditions.",
          "oneOf": [
            {
              "additionalProperties": true,
              "description": "A group of conditions.",
              "properties": {
                "children": {
                  "items": {
                    "additionalProperties": true,
                    "description": "A condition or a nested group.",
                    "properties": {
                      "condition": {
                        "additionalProperties": true,
                        "description": "A field condition.",
                        "properties": {
                          "field_id": {
                            "description": "The field's id.",
                            "type": "integer"
                          },
                          "operator": {
                            "description": "The comparison, such as eq, neq, contains, is_empty or is_not_empty.",
                            "type": "string"
                          },
                          "value": {
                            "description": "The value to compare with."
                          }
                        },
                        "type": "object"
                      },
                      "group": {
                        "additionalProperties": true,
                        "description": "A group of conditions.",
                        "properties": {
                          "children": {
                            "items": {
                              "additionalProperties": true,
                              "description": "A condition or a nested group.",
                              "properties": {
                                "condition": {
                                  "additionalProperties": true,
                                  "description": "A field condition.",
                                  "properties": {
                                    "field_id": {
                                      "description": "The field's id.",
                                      "type": "integer"
                                    },
                                    "operator": {
                                      "description": "The comparison, such as eq, neq, contains, is_empty or is_not_empty.",
                                      "type": "string"
                                    },
                                    "value": {
                                      "description": "The value to compare with."
                                    }
                                  },
                                  "type": "object"
                                },
                                "group": {
                                  "description": "A nested group, as this one."
                                }
                              },
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "conjunction": {
                            "description": "Whether all children or any child must hold.",
                            "enum": [
                              "and",
                              "or"
                            ],
                            "type": "string"
                          }
                        },
                        "type": "object"
                      }
                    },
                    "type": "object"
                  },
                  "type": "array"
                },
                "conjunction": {
                  "description": "Whether all children or any child must hold.",
                  "enum": [
                    "and",
                    "or"
                  ],
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "asOrigin": {
      "description": "system:<name> writes as a host feature, outside the undo history. Agents leave it out.",
      "type": "string"
    },
    "tableId": {
      "description": "The table's id.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-types": [
        "Table"
      ]
    },
    "tree": {
      "additionalProperties": false,
      "properties": {
        "children": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "condition": {
                "additionalProperties": false,
                "properties": {
                  "field_id": {
                    "default": 0,
                    "oneOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "x-khp-role": "object",
                    "x-khp-types": [
                      "Field"
                    ]
                  },
                  "operator": {
                    "default": "",
                    "type": "string"
                  },
                  "value": {}
                },
                "type": "object"
              },
              "group": {
                "additionalProperties": false,
                "properties": {
                  "children": {
                    "items": {},
                    "type": "array"
                  },
                  "conjunction": {
                    "default": "",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "conjunction": {
          "default": "",
          "type": "string"
        }
      },
      "type": "object"
    },
    "viewId": {
      "description": "The view's id.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-types": [
        "View"
      ]
    }
  },
  "required": [
    "tableId",
    "viewId"
  ],
  "type": "object"
}

Generated from kition-sdk packages/script/kits/table.ts and the kit itself (kition-table@ee73209). As data: commands.jsonl.