Two datasources, two grids


I have two tables: t1 (main table), t2 (related table).

I should show on form only t1 and t2 records, where for t1 related t2 records exist,

Normaly I could use InnerJoin, but I have two grids: t1, t2.

I tried:

  1. InnerJoin shows the same count of resords for t1, how much records exists for t2.
  2. OuterJoin return all t1 records, even related records not exist in t2
  3. ExistJoin return correct redords for t1, but records without values for t2.

Is here some solution?


You could add 3 datasources to your form, 1 for the table t1 an 2 for the table t2, let’s call them t2a and t2b

In your form, base your first grid on t1 and the second grid on t2b

In the properties of the t2a, select t1 in the property JoinSource and use ExistsJoin in the property Link Type; and for the datasource t2b do not select JoinSource and leave the default value(Delayed) for the property Link Type.

Then use a dynalink to filter the records of the second grid overriding ExecuteQuery of the datasource t2b:

public void executeQuery()


//fieldName would be the names of the fields that relates t1 and t2


t2b_ds.query().dataSourceTable(tableNum(t2)).addDynalink(fieldNum(t2, fieldName), t1, fieldNum(t2, fieldName));



Best Regards,

Manuel Esquivel

Hi Maris,

U tried ACTIVE…it also shows two datasource records means like when u r clicked table1 records in one form other form shows that table1 related field in table2…when u click other record it will automatically shows that related records once u try…


Thanks for suggestion. I will try this on evening.

Br, Maris

Thanks a lot!

It works great!

Br, Maris

Hi Maris,

Please don’t forget to verify a solution if it resolved your issue Idea

why because next time it is easy for other people…