Hi Lucifer, Some notes and examples below. Cheers James RTDMTable The RTDMTable (com.sas.analytics.ph.common.RTDMTable) type corresponds to a datagrid. It has many useful features for manipulation & traversal. It is required to include the EventInfo object on many RTDMTable methods Create, Write, Read, Delete Here are the basic CRUD operations to work with the RTDMTable object from Python. It also illustrates when the builtin EventInfo object will also be needed inside your activities (for handling WHERE expressions). Example: import java.util.Collections as Collections import java.lang.Long as Long import com.sas.analytics.ph.common.RTDMTable as RTDMTable import com.sas.analytics.ph.common.exp.SymbolTable as SymbolTable import com.sas.analytics.ph.common.jaxb.DataTypes as DataTypes newTable = RTDMTable() # Defining columns newTable.columnAdd("MY_STRING_COLUMN", DataTypes.STRING, Collections.emptyList()); newTable.columnAdd("MY_INT_COLUMN", DataTypes.INT, Collections.emptyList()); # Adding a new row newRow = newTable.rowAdd() newRow.columnDataSet("MY_STRING_COLUMN", "A String value.") newRow.columnDataSet("MY_INT_COLUMN", Long(52)); # Iterating over the table & reading values it = newTable.iterator() while it.hasNext(): row = it.next() value = row.columnDataGet("MY_STRING_COLUMN") num_value = row.columnDataGet("MY_INT_COLUMN") # Deleting all rows with MY_INT_COLUMN greater than 5 newTable.delete(SymbolTable(), "newTable", eventInfo, "newTable.MY_INT_COLUMN GT 5", None); SELECT from existing datagrids To sub-select from an existing datagrid, you use the select() method. The parameters should be familiar to anyone who has used the TableSelect function within a calculated variable. Here is an example: ("fordCars" is an "Output Variable","cars" is a "Input Variable"): import com.sas.analytics.ph.common.exp.SymbolTable as SymbolTable fordCars=cars.select(SymbolTable(), "myTable", eventInfo, "Model", "myTable.Make EQ 'Ford'", None) Join Tables Joining tables is a bit more complicated. RTDM supports only INNER joins between in-memory tables. The syntax should be familiar to those using the TableInnerJoin functionality within calculated items. Here is an example: ("joinedTable" is an "Output Variable", "tableA" and "tableB" are "Input Variables") import com.sas.analytics.ph.common.exp.SymbolTable as SymbolTable joinedTable = tableA.innerJoin( SymbolTable(), "A", # Name for the customer table for use in the columns & WHERE tableB, # The right hand side table "B", # Name for the right hand side table eventInfo, # The event info object (in case of date math) "*", # The columns to retain in the joined table, all in this case "A.Product_code EQ B.Product_number", # The WHERE clause for the JOIN None ) Sorting On the RTDMTable object, there is a direct sort method. This sorts the table in place. You can sort on one or more columns. Example: ("inputTable" is an "Input Variable", "outputTable" is an "Output Variable") inputTable.sort("Color ASCENDING") outputTable=inputTable
... View more