Forms, subforms, and OnAfterGetCurrRecord

jreynoldsjreynolds Member Posts: 175
edited 2011-05-15 in NAV Three Tier
Sometimes the SubFormLink property just isn’t enough to establish the desired relationship between the current record on the main form and the records on a subform. When this happens we have been able to use (in the classic client) the OnAfterGetCurrRecord trigger on the main form to call a function on the subform. Typically, this function is passed values from the main form that are used to set the proper filters on the subform; the filters on the subform are typically set in filter group 4 to keep them isolated and therefore not able to be changed by the end user.

I’m looking to do something similar with pages and subpages and am struggling because of the fact that there is no OnAfterGetCurrRecord trigger for pages. I have noticed that an example of this practice in the W1 database is form 521 (Application Worksheet). In 5.0SP1 this form uses the OnAfterGetCurrRecord trigger to set filters on its two subforms. In NAV2009 this form has been redesigned and the resulting form and page no longer has subforms; they have been replaced be separate forms that are run by making selections from a menu button. I don’t particularly care for the new user interface and am looking for a way to deliver something closer to what was possible witht he classic client. Does anyone have any ideas on how to achieve this?

Comments

  • kinekine Member Posts: 12,562
    There is technical problem with that. RTC is reading data during page opening. After that, the dataset is not "refreshed". And this is why there is no "next/preview" on the pages and why the subpage cannot be filtered based on some business logic. Because it will lead to have some process to "re-read" the dataset during the page is opened...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Nav_NoobNav_Noob Member Posts: 25
    I have the same problem. In a grid on a form, I can run code in the OnAfterGetCurrRecord() function when the user selects rows in the grid. Is there any equivalent for pages? Is there any way to tell when the user selects a different row in a grid on a page?

    Thanks,
    Adam
  • KowaKowa Member Posts: 918
    Has someone found a workaround for this issue? We have several forms with 3 subforms which don't react to filtering like they used to with the RTC. Either they find too many records, and if they find the right records for one main form record they display these subpage records for the next main form record too.
    Kai Kowalewski
  • awarnawarn Member Posts: 261
    I am having a similar issue with new forms we have designed.

    Our forms have a worksheet (like a journal) on the main form, and then a subform (like item tracking lines), showing also.

    We are having issues with the subform (item tracking lines) that are being displayed properly, but if we try and add a new record, if may or may not get inserted properly with the proper linking. It would be very frustrating to remove this functionality for use with pages.
  • Rob_HansenRob_Hansen Member Posts: 296
    I just wanted to bring this thread up and state that this is a big limitation with the RTC and I hope Microsoft will find a way to get the OnAfterGetCurrRecord trigger back in version 7. I have a similar form/subform situation where a list page in the header needs to refresh a sub-page with details for the current record (that can't be done with a link...it's not a related table) and the only way I can do it right now is to force the user to run an action manually as they move onto each record. Very ugly...
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    rdhansen wrote:
    I just wanted to bring this thread up and state that this is a big limitation with the RTC and I hope Microsoft will find a way to get the OnAfterGetCurrRecord trigger back in version 7.
    Microsoft (MDCC) is monitoring this forum, so maybe they will pick this one up ;-)
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    I'm not very familiar with the RTC as we don't use it by now. But I've maybe had a similar situation where the two tables are not related in a direct way. I created some kind of subform in a subform to display the three table relation. I don't know if it's possible to create something like a subpage in a subpage. But maybe that's an option. :?:
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • horinashorinas Member, Microsoft Employee Posts: 4
    Actually reintroducing the OnAfterGetCurrRecord trigger is a feature that we intend to deliver in NAV7. :)
    Horina Serbanescu
    SDE II
    Dynamics Nav Client
    Microsoft

    This posting is provided "AS IS" with no warranties, and confers no rights.
Sign In or Register to comment.