[]
A table item describes a structured reference to a table, including the table name, the referenced table part, and the source column or column range. Use this class to build or inspect syntax nodes for references such as headers, data, totals, or specific table columns.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("DeptSales[[#Headers],[#Data],[ComPct]]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
String tableName = tableItem.getTableName();
TableItemType itemType = tableItem.getItemType();
String columnName = tableItem.getColumnFrom();
TableItemNode(String tableName,
TableItemType itemType,
String columnName) TableItemNode from a single column of a table.TableItemNode(String tableName,
TableItemType itemType,
String columnFrom,
String columnTo) TableItemNode that represents a table structured reference spanning a range of columns.final Stringfinal Stringfinal TableItemTypefinal Stringfinal voidsetColumnFrom(String value) final voidsetColumnTo(String value) final voidsetItemType(TableItemType value) final voidsetTableName(String value) getChildrenTableItemNode from a single column of a table.This constructor creates a table item for the specified table name, table part, and column name. It passes columnName as the start column and null as the end column to TableItemNode(String,TableItemType,String,String).
TableItemNode tableItem = new TableItemNode("DeptSales", TableItemType.Headers, "Amount");
FormulaSyntaxTree syntaxTree = new FormulaSyntaxTree();
syntaxTree.setRoot(tableItem);
String formulaText = syntaxTree.toString();
tableName - The name of the table.itemType - The table part represented by the structured reference.columnName - The column name to reference. This value is passed as the start column.TableItemNode that represents a table structured reference spanning a range of columns.Use this constructor to specify the table name, the referenced table item type, and the start and end columns for the structured reference.
TableItemNode tableItem = new TableItemNode(
"DeptSales",
TableItemType.Data,
"Amount",
"Discount"
);
FormulaSyntaxTree syntaxTree = new FormulaSyntaxTree();
syntaxTree.setRoot(tableItem);
String formulaText = syntaxTree.toString();
tableName - The name of the table.itemType - The table item type represented by the structured reference.columnFrom - The name of the first column in the referenced column range.columnTo - The name of the last column in the referenced column range.Use this method to retrieve the table name stored in the current TableItemNode.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("DeptSales[[#Headers],[#Data],[ComPct]]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
String tableName = tableItem.getTableName();
null if no table name has been set.Use this method to update the table name stored in the current TableItemNode.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("[@ComPct]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
tableItem.setTableName("DeptSales");
String formulaText = syntaxTree.toString();
value - The table name to set. Use null to clear the table name.The returned item type indicates which section of the table this TableItemNode represents in a structured reference, such as headers, data, or totals.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("DeptSales[[#Headers],[#Data],[ComPct]]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
TableItemType itemType = tableItem.getItemType();
null if no item type has been assigned.The item type identifies which part of the table this TableItemNode represents. The value is defined by TableItemType.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("DeptSales[Amount]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
tableItem.setItemType(TableItemType.Headers);
String formulaText = syntaxTree.toString();
value - The table item type to set.This method returns the first column name in the structured reference represented by this TableItemNode. For a single-column table item, it returns that column name. For a column range, it returns the start column of the range.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("DeptSales[[#Headers],[#Data],[ComPct]]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
String columnFrom = tableItem.getColumnFrom();
null if no start column has been set.This method sets the first column name in the structured reference represented by this TableItemNode. For a single-column table item, it sets that column name. For a column range, it sets the start column of the range.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("DeptSales[[#Data],[Q1]:[Q3]]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
tableItem.setColumnFrom("Q2");
String formulaText = syntaxTree.toString();
value - The start column name to set. Use null to clear the start column.For a TableItemNode that represents a range of columns, this method returns the last column name in that range. If the node represents a single column reference, this method returns null.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("DeptSales[[#Headers],[#Data],[ComPct]:[Column3]]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
String columnTo = tableItem.getColumnTo();
null if this node does not specify an end column.For a TableItemNode that represents a range of columns, this method sets the last column name in that range. If the node represents a single column reference, this method sets null.
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("DeptSales[[#Data],[Amount]:[Total]]");
TableItemNode tableItem = (TableItemNode) syntaxTree.getRoot();
tableItem.setColumnTo("Discount");
String formulaText = syntaxTree.toString();
value - The end column name to set. Use null when this node should not specify an end column.