Do DatasetModels have something like FetchRelatedRecords in BusinessEntity?
 
Forums / SmartComponent Library - Developer Forum / Do DatasetModels have something like FetchRelatedRecords in BusinessEntity?

Do DatasetModels have something like FetchRelatedRecords in BusinessEntity?

3 posts, 0 answered
  1. Patrik Wikström
    Patrik Wikström avatar
    68 posts
    Registered:
    15 Oct 2018
    15 Jan
    Link to this post
    Do DataSetmodel have the possibility to have the father-records fetched when filtering on child records?
  2. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    15 Jan in reply to Patrik Wikström
    Link to this post
    You can certainly populate those records using calls to FetchRelatedRecords from FetchData in the BusinessEntity. 

    The DatasetModel _might_ not expect records there and might not open the query in the parant buffer accordingly. That might be fixed by calling into OpenQuery() method of the table model.

    By the way: A nice way of linking data in different DatasetModels is to use the 

    Consultingwerk.BusinessEntityDesigner.Plugins.BusinessEntityRelationsPlugin

    plugin. That adds the "Table Relations" button to the "Temp Table" band in the Ribbon.Using that plugin you can generate a "GetSalesrep()" method on the CustomerTableModel which returns a SalesRepDatasetModel instance with the related salesrep.
  3. Patrik Wikström
    Patrik Wikström avatar
    68 posts
    Registered:
    15 Oct 2018
    17 Jan
    Link to this post
    Used CustomContext for the POC and called FetchRealtedRecords in the ReceiveData method in the business entity when a certain value was delivered in the CustomContext.
    Worked ok with the DatasetModel using your instructions, e.g. calling OpenQuery on the father TableModel. One additional thing was needed to get the DatasetModel in the right mode (UseDatasetQueries), we set the child table also as the FillChildTables.
    xDM:Child:FillChildTables = "eChild" before calling the Fill method.

    Thanks for the additional tip!
3 posts, 0 answered