1
votes

I have two grids. The first displays keys, and the second displays a list of related items in another table. Since the grids are on different tabs, I put a filter on the pageActivated method for the second grid's tab.

Some pseudo code to get my point across without posting 200 lines of x++

override page2Activated() {
    dataSource2_ds.removeFilter();
    dataSource2_ds.filter using grid1Field.valueStr();
}

This works nicely, as long as grid1 has rows in it when the form is opened. If there are no rows when the form is opened, even after adding a row to grid1, something doesn't get updated, and grid2 will always be blank.

Then, I tried looking at the datasource instead of the grid fields.

override page2Activated() {
    dataSource1 firstTable;
    firstTable = dataSource1_ds.getFirst(true);
    dataSource2_ds.removeFilter();
    dataSource2_ds.filter using firstTable.recID;
}

The problem with this one is that it only works if you click the checkbox next to a record.

I'd like to to work with a highlighted record in grid1, without having to click the checkbox.

Any suggestions?

1
Have you tried joining the data sources? - SShaheen
That worked. Boy was I going about it the hard way. Thanks for the help. - Brad

1 Answers

0
votes

Question answered in comments above. Posted as answer so the question can be marked closed.

Rather than using code to manually filter the records, link the tables using the datasource properties JoinSource and LinkType. Set JoinSource to the linked table and LinkType to Active.