1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import com.im.commons.db.ddl.GenericColumnType // These imports are not necessary in 5.9 and later import com.im.commons.progress.* import com.im.df.api.capabilities.* import com.im.df.api.util.*; import com.im.df.api.ddl.*; import com.im.commons.db.ddl.*; import com.im.df.api.support.*; def ety = dataTree.rootVertex.entity ety.schema.lockable.withLock( 'Create a new CT field' ){ envRW -> // In IJC 5.11 and earlier def Class[] req1 = [ DFFieldChemicalTermsCapability. class ] def nt = DIFUtilities.findFirstAppropriateNewType(ety.getFields().getNewTypes(), false, req1, new Class[ 0 ]) nt.options.newDFItemNameSafe = "Atom Count" nt.options.formulaSync = "atomCount" nt.options.genericType = GenericColumnType.INTEGER nt.create(envRW) // End of 5.11 code // In IJC 5.12 and later // DFFields.createChemTermsField(ety, "atomCount", GenericColumnType.INTEGER, "atomCount()", envRW) // End of 5.12+ code } |
Versions: This script has been tested on IJC version 6.0