About cookies on this site Our 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 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.
Last updated: Feb 11, 2025
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
Method | Return types | Description |
---|---|---|
|
|
Returns the number of rows in this table. |
|
|
Returns the number of columns in this table. |
|
|
Returns the name of the column at the specified column index. The column index starts at 0. |
|
|
Returns the storage type of the column at the specified index. The column index starts at 0. |
|
|
Returns the value at the specified row and column index. The row and column indexes start at 0. |
|
|
Flushes any internal storage associated with this content model. |
Nodes and outputs
This table lists nodes that build outputs that include this type of content model.
Node name | Output name | Container ID |
---|---|---|
|
|
|
Example script
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
Was the topic helpful?
0/1000