Hi
I would like some help to create a loop that finds all related table relations (which are 2 in this case) using a tableId and a FieldId.
I have an issue that my code only finds the first relation instead of both relations
As an example:
MainTable has field A with 2 relations:
Relation 1 MainTable.A = FirstRelation.A && MainTable.B = 2
Relation 2 MainTable.A = SecondRelation.A && MainTable.B = 1
So my code only finds FirstRelation and retuns the tableId of table FirstRelation eg. tabelId = 16402
Could some one help me to write a Job that uses a tableId and fieldId that loops all the relations of this fieldId
Loop should be in the if statement.
static void findAllTableRelations(Args _args)
{
TableId _tableId;
FieldId _fieldId;
SysDictField sysDictField;
SysDictRelation sysDictRelation;
//real values of the table- and fieldId
_tableId = 124670; //MainTable
_fieldId = 60136; //field A
sysDictField = new SysDictField(_tableId, _fieldId);
sysDictRelation = new SysDictRelation(_tableId);
if (sysDictRelation)
{
//this should be some kind of loop so that both related tables are found
refTableId = sysDictRelation.loadFieldRelation(sysDictField.id(), TableScope::IncludeBaseTables);
breakpoint;
}
}
Thanks in advance
Tomas
*This post is locked for comments
I have the same question (0)