'Is there an Object-Oriented way to use standard reporting events?

Is there an Object-Oriented way to create functionality for the standard reporting events like INITIALIZATION or AT SELECTION-SCREEN?



Solution 1:[1]

I can't test this, but perhaps a table variable with your dates would work:

DECLARE @Dates table (ToDate date);
INSERT INTO @Dates (ToDate)
VALUES('20211231'),
      ('20210930'),
      ('20211031'),
      ('20211130');

SELECT ICT.iStockID,
       ICT.iWarehouseID,
       --D.ToDate, --Not sure if you need this or not
       MAX(ICT.dTxDate) AS Latest_Date
FROM dbo._etblInvCostTracking ICT
     JOIN @Dates D ON ICT.dTxDate < D.ToDate
WHERE ICT.fQtyOnHand <> '0' --Should this not be an int, rather than a varchar?
GROUP BY ICT.iStockID,
         ICT.iWarehouseID,
         D.ToDate;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1