Forum Stats

  • 3,733,007 Users
  • 2,246,671 Discussions
  • 7,856,463 Comments

Discussions

template table not adding in logical entity


template table is not adding in my logical model. Can you help me in the issue?

// columns are found by column name

// allowing reuse of already existing columns

// dynamic property ctemplateID is set afterwards - will keep connection to template

// column even if the name of column is changed

var t_name = "table_template";

var p_name = "ctemplateID";

template = model.getTableSet().getByName(t_name);

if(template!=null){

tcolumns = template.getElements();

tables = model.getTableSet().toArray();

for (var t = 0; t<tables.length;t++){

table = tables[t];

// compare name ignoring the case

if(!table.getName().equalsIgnoreCase(t_name)){

for (var i = 0; i < tcolumns.length; i++) {

column = tcolumns[i];

col = table.getColumnByProperty(p_name,column.getObjectID());

if(col!=null){

attr = col.getEngAttribute();

if(attr!=null){

ent = attr.getEntity();

attr.remove();

if(ent!=null){

ent.setDirty(true);

}

}

col.remove();

table.setDirty(true);

}

}

}

}

}

Answers

  • Philip Stoyanov-Oracle
    Philip Stoyanov-Oracle Member Posts: 3,329 Employee

    there is and example for entity template in SQLDeveloperDataModelerScripting.docx and it's in datamodeler\datamodeler\xmlmetadata\doc directory of your DM installation. It's good to read that document if you are going to use scripting

    Philip

  • Dave Schleis
    Dave Schleis Member Posts: 215 Silver Badge

    Hello

    This script, provided by default and called "Table template - uses column name" is designed to run against your relational model, as seen in the "Object" column below, not your logical model.

    Philip is absolutely correct. Read the provided documentation, and ALWAYS SAVE before running a script. Scripting is a very powerful feature that can transform your model in seconds. This also means that a you can ruin a model if used incorrectly.

    If you want to learn more about scripting, you may find this webinar interesting.

    hope this helps

    --dave

Sign In or Register to comment.