How to do additional filtering on a DatasetModel's child table
 
Forums / SmartComponent Library - Developer Forum / How to do additional filtering on a DatasetModel's child table

How to do additional filtering on a DatasetModel's child table

2 posts, 1 answered
  1. Simon Prinsloo
    Simon Prinsloo avatar
    11 posts
    Registered:
    20 Feb 2019
    20 Dec 2019
    Link to this post
    Good day

    Consider a dataset model containing an Order and OrderLine table model, with the relation on the OrderNo field.

    Thus, to retrieve and Order with its Lines, I can do this:
    dsm = NEW OrderDatasetModel().
    dsm:Order:Filter:OrderNo:EQ(15).
    dsm:Order:FillOrderLine = TRUE.
    dsm:Order:Fill().
    However, in my use case, I only want some of those order lines, lets say only the ones with a Status less that 10.

    What is the simplest correct way to achieve this?

    I tried the following, but the filter on OrderLine is ignored and I still get all the OrderLine records:
    dsm = NEW OrderDatasetModel().
    dsm:Order:Filter:OrderNo:EQ(15).
    dsm:Order:FillOrderLine = TRUE.
    dsm:OrderLine:Filter:Status:LT(10).
    dsm:Order:Fill().

    Regards
    Simon
  2. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    Answered
    20 Dec 2019 in reply to Simon Prinsloo
    Link to this post
    I believe this is not possible.
2 posts, 1 answered