Hello,
I am writing a script to add default columns and their values to tables. So far for me it's possible to add columns to an existing table in the model.
Next I want to add the value for datatype. I found out there's a method called getDataType(). Until now, I didn't find the 'setter; for this property.
Like other scripts, I started with create a table with columns and then using the API to read the values.
A simplified version of my code:
// get columns array
var myTab = model.getTableSet().getByName("T_POSITIONS");
colArray = myTab.getElementsCollection().toArray();
// loop over columns
for(i = 0; i < colArray.length; i++){
var dataType = colArray[i].getDataType();
model.getAppView().log(colArray[i] + " has datatype " + dataType );
colArray[i].setDataType("VARCHAR2 (1)");
}
An error occurs when I want to run this script: Cannot find function setDataType in object ID.
I cannot find the right method to add/modify the datatype property.
Any tip would be appreciated.