Unable to add link on form datasource

Hi Everyone

I have a requirement where I need to add a datasource(Table2) to the form with a join to existing datasource(Table1) and use a field from the newly added datasource to be shown on the grid of this form which can be filtered/sorted.

I tried the following steps

1.Add the new datasource to the form and specify the join source and join type.

  1. In the init method of newly added datasource, executed addLink method as following specifying the link between the fields

QueryBuildDatasource qbds = this.queryBuildDatasource();

qbds.clearLinks();

qbds.addLink(Table1 field, Table2 field);

But the newly added field value is not displaying properly on the grid. When I filter records based on field of Table1 I can see the Table2 field value but this value is not consistent when i remove the filter I cannot see the value when i scroll or I was not able to do a filtering on the newly added field.

Note: There is already an existing relation on Table1 with Table 2. But in this case i need the data from table 2 based on a newly added field on Table 1 which has recid values of Table 2 I used this in the addLink

Can anyone let me know If i am missing anything or Is there any other way to acheive this.

Thanks in Advance

What type of join did you use? InnerJoin?

Also note that you shouldn’t normally use addLink() - use table relations instead whenever possible.