theriom.com
This blog is mainly for me, a way of remembering things I've done; when I couldn't find an answer on Google, I wrote about it here. Hopefully, other people may find it helpful too.
Change all data types in logical models from domain to logical

Data Modeler transformation script to change all data types in logical models from domain to logical.

This can be run from the Transformation Dialog. Transformations Dialog

function getDateAsString()
{
	var d = new Date();

	return d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDate();
}

function prependNotes(item, prependString)
{
	currentNote = item.getNotes();

	var versionNotes = "[" + getDateAsString() + ":" + prependString + "]\n";

	item.setNotes(versionNotes + currentNote);
}

function processEntity(entity)
{		
	attributes = entity.getAttributes();
	for(var b=0; b < attributes.length; b++)
	{
        processAttributes(entity, attributes[b]);
	}
}

function processAttributes(entity, attribute)
{
	name = attribute.getName();

	if(attribute.getDataTypeKind() != "LT")
	{		
        attribute.setLogicalDatatype(attribute.getLogicalDatatype());
        attribute.setDomain(null);
        attribute.setDirty(true);

        prependNotes(attribute, "DataType Kind changed from Domain to Logical");
	}
}

entities = model.getEntitySet().toArray();
//entities = model.getSubViewByName("subviewname").getEntities();

for(var a=0; a < entities.length; a++)
{
	processEntity(entities[a]);
}

Last modified on 2016-03-20