I’m developing a macro that adds an Entity and its related sequence to PostgreSQL model. After macro ends I launch a model test and I get this message:
Nonpaired objects “TPERCustomObject.<name_of_seq>” and"TPEREntity.<name_of_entity>", property “OwnedByTable”. Back link is missing.
Macro for adding tables:
Entity = Model.CreateNewObject(2002); // add new entity
Entity.Name = “…”;
Entity.Caption = “…”;
//…code for adding attributes, PK, …, and other table stuff
Macro for adding sequences:
var seq = Model.CreateNewObject(51000); //sequence
seq.Name = “…”;
if (seq.SupportsProperty(“OwnedByTable”)) {
seq.OwnedByTable = Entity;
seq.OwnedByColumn = prefix + “_CODE”;
var atr = Entity.Attributes.GetObjectByName(seq.OwnedByColumn);
atr.DefaultValue = “nextval(’” + nomSeq + “’)”;
}
if (seq.SupportsProperty(“StartWith”)) {
seq.StartWith = “1”;
}
if (seq.SupportsProperty(“IncrementBy”)) {
seq.IncrementBy = “1”;
}
if (seq.SupportsProperty(“Cache”)) {
seq.Cache = “10”;
}
if (seq.SupportsProperty(“Comments”)) {
seq.Comments = "Secuencia para " + Entity.Name + “.” + prefix + “_CODIGO”;
}
What does it means “Back link is missing.”? Some kind of “link” in the table or attribute?