The table content model provides a simple model for accessing simple row and column data. The
values in a particular column must all have the same type of storage (for example, strings or
integers).
API
Copy link to section
Table 1. Methods for the table content model
Method
Return types
Description
getRowCount()
int
Returns the number of rows in this table.
getColumnCount()
int
Returns the number of columns in this table.
getColumnName(int columnIndex)
String
Returns the name of the column at the specified column index. The column index starts
at 0.
getStorageType(int columnIndex)
StorageType
Returns the storage type of the column at the specified index. The column index starts
at 0.
getValueAt(int rowIndex, int columnIndex)
Object
Returns the value at the specified row and column index. The row and column indexes
start at 0.
reset()
void
Flushes any internal storage associated with this content model.
Nodes and outputs
Copy link to section
This table lists nodes that build outputs that include this type of content model.
Table 2. Nodes and outputs
Node name
Output name
Container ID
table
table
"table"
Example script
Copy link to section
stream = modeler.script.stream()
from modeler.api import StorageType
# Set up the variable file import node
varfilenode = stream.createAt("variablefile", "DRUG Data", 96, 96)
varfilenode.setPropertyValue("full_filename", "$CLEO_DEMOS/DRUG1n")
# Next create the aggregate node and connect it to the variable file node
aggregatenode = stream.createAt("aggregate", "Aggregate", 192, 96)
stream.link(varfilenode, aggregatenode)
# Configure the aggregate node
aggregatenode.setPropertyValue("keys", ["Drug"])
aggregatenode.setKeyedPropertyValue("aggregates", "Age", ["Min", "Max"])
aggregatenode.setKeyedPropertyValue("aggregates", "Na", ["Mean", "SDev"])
# Then create the table output node and connect it to the aggregate node
tablenode = stream.createAt("table", "Table", 288, 96)
stream.link(aggregatenode, tablenode)
# Execute the table node and capture the resulting table output object
results = []
tablenode.run(results)
tableoutput = results[0]
# Access the table output's content model
tablecontent = tableoutput.getContentModel("table")
# For each column, print column name, type and the first row# of values from the table content
col = 0
while col < tablecontent.getColumnCount():
print tablecontent.getColumnName(col), \
tablecontent.getStorageType(col), \
tablecontent.getValueAt(0, col)
col = col + 1
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.