111
Views
6
Comments
Solved
Find the List of associated Entities to a Entity
Application Type
Reactive

Hi All,

I need to find the list of all associated Entities to an Primary Entity i have the list of all attributes of Primary Entity can anyone please suggest me how to find all the associated Entities through these attributes i need to show the list of associated entities in dropdown List.   

Thanks,

Jitendra

2022-07-28 08-07-39
Jitendra Kumar
Solution

Hi @Daniël Kuhlmann ,

I have little bit a trick in that through the primary attribute i got from my primary entity i have got the type of every attribute of my primary entity in entity attribute table .

By using that type i have applied an filter on entity attribute table and got the list of all attribute which are of that particular and through entity attribute table i have got the Entity Id in which that referencing attribute is being used using that concept i have got the list of all associated table 


Thanks & Regards,

Jitendra

2024-09-19 13-52-30
Kavinilammurugu (Kavin)

Hi Jitendra, 
We can use the below given SQL to get the list of tables referencing the parent table. There is an input parameter for this SQL which is ParentTable's Physical Name.

SELECT  obj.name AS FK_NAME,    sch.name AS [schema_name],    tab1.name AS [table],    col1.name AS [column],    tab2.name AS [referenced_table],    col2.name AS [referenced_column],    '' as [logical_table_name]FROM sys.foreign_key_columns fkcINNER JOIN sys.objects obj    ON obj.object_id = fkc.constraint_object_idINNER JOIN sys.tables tab1    ON tab1.object_id = fkc.parent_object_idINNER JOIN sys.schemas sch    ON tab1.schema_id = sch.schema_idINNER JOIN sys.columns col1    ON col1.column_id = parent_column_id AND col1.object_id = tab1.object_idINNER JOIN sys.tables tab2    ON tab2.object_id = fkc.referenced_object_idINNER JOIN sys.columns col2    ON col2.column_id = referenced_column_id AND col2.object_id = tab2.object_id    where tab1.name like '%'+@EntityName+'%'     order by referenced_table


I have attached a sample OML below for your reference. I have used the mentioned SQL query in "MainFlow -> Screen1  -> GetListOfChild( Data Action)"


Hope this helps.

TestApplication.oml
2022-07-28 08-07-39
Jitendra Kumar

Thankyou so much for the response let me check with it and i will update you for the same


Regards,

Jitendra 

2024-09-19 13-52-30
Kavinilammurugu (Kavin)

Hi Jitendra, 
Did you managed to implement and try.


2022-07-28 08-07-39
Jitendra Kumar

I have tried but this is not the solution i wanted although i have achieved my functionality with some extra efforts thanks for the help.


Regards,

Jitendra

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Maybe you elaborate then  how you actually achieved a solution to your question.

2022-07-28 08-07-39
Jitendra Kumar
Solution

Hi @Daniël Kuhlmann ,

I have little bit a trick in that through the primary attribute i got from my primary entity i have got the type of every attribute of my primary entity in entity attribute table .

By using that type i have applied an filter on entity attribute table and got the list of all attribute which are of that particular and through entity attribute table i have got the Entity Id in which that referencing attribute is being used using that concept i have got the list of all associated table 


Thanks & Regards,

Jitendra

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.