テーブル内容モデル
テーブルコンテンツモデルは、単純な行と列のデータにアクセスするためのシンプルなモデルを提供します。 特定の列の値はすべて、同じタイプのストレージ(例えば、文字列または整数)でなければなりません。
API
| メソッド | 戻り値の型 | 説明 |
|---|---|---|
getRowCount() |
int |
このテーブルの行数を返します。 |
getColumnCount() |
int |
このテーブルの列数を返します。 |
getColumnName(int columnIndex) |
String |
指定された列インデックスの列名を返します。 列のインデックスは0から始まります。 |
getStorageType(int columnIndex) |
StorageType |
指定したインデックスのカラムのストレージタイプを返します。 列のインデックスは0から始まります。 |
getValueAt(int rowIndex, int columnIndex) |
Object |
指定された行と列のインデックスの値を返します。 行と列の索引は 0 から始まります。 |
reset() |
void |
このコンテンツモデルに関連する内部ストレージをすべて消去します。 |
ノードと出力
この表には、このタイプのコンテンツ・モデルを含む出力を作成するノードがリストされています。
| ノード名 | 出力名 | コンテナー ID |
|---|---|---|
table |
table |
"table" |
例文
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