This question requires a bit of setup, so please bear with me!
I have a three-level deep relational hierarchy: Customers, Jobs, and Uploads. I have defined three forms (all table views), one each for each of these tables. All three table views show in tabless tab panels on a fourth form called ‘main’. Main is based on the Customer table. The Jobs table view tab panel is related to Customers via a cust_sn that appears in both files. Uploads is related to Jobs via a relationship with a global field on the left that gets populated with the job_sn when triggered by the OnRecordSelected event.
The goal is to select a customer in the top table view, have that result in the display of that customer’s jobs in the second table view, and have the selected job in the second table automatically result in the display of the uploads for that job in the third table view. When you click back and forth between customers in the top tab panel, the jobs tab panel correctly shows that client’s jobs. Here’s the problem: This changing of displayed jobs in the second tab panel does not result in an OnRecordSelected event on the jobs form, so the Uploads tab panel never displays anything unless you manually click on a row in the jobs table view. Questions: Is there any way to trigger this? Is there a better way to set up the relationships so I don’t have to resort to sticking the value of job_sn in a global when the user clicks on a job row to force the appropriate display in the Uploads table view?
Addendum to above. Had been testing with only two customers, one with jobs and one without jobs. Going from the customer with jobs to one without and back again results in nothing displayed in the Uploads tab panel table-view. If I go back and forth between two customers who have jobs, everything works fine! I’m guessing this means that OnRecordSelected is not firing when the same ‘Jobs’ recordset is redisplayed after an empty (as opposed to different) recordset is displayed. Can this be fixed?
Addendum 2: OK. I think I can now ask the question in a more generic way. In the case where one is using a table view in a tabless tab panel to emulate a portal–in other words–the records displayed in the table view are determined by a relationship–is there any event associated with the table-view form that fires when the displayed set of records changes?
The table view is displayed in a tabless tab-panel on a ‘master’ layout and thus is always visible. That lets out OnShow and OnHide. The records being displayed are controlled by a record selected in another tabless tab-panel – that means that in a case where you are going from records displayed in the target tab panel to no records displayed and back again, the OnRecordSelected event does not trigger. That’s where I’m stuck. Can’t come up with an event that triggers in these circumstances.
I’m either talking about modifying the functionality of ‘OnRecordSelected’, or adding a more complicated version (‘OnRecordSelectedChanged’). The new version adds the following functionality: In addition to triggering when the user clicks on a record in a list or table or when some external event results in changing the foundset from one group of records to another, it also triggers if…
The displayed recordset suddenly has no records in it. (In essence, this amounts to a change in the selected record because what was the selected record isn’t in the set anymore.)
The displayed recordset has records in it (including a selected record), is changed to a set with no records in it, and then changed back to the identical first set (which will have the original record still selected). To my way of thinking, this amounts to a change in the selected record because there is no selected record when the foundset is empty, but is one once the foundset is restored.