I have a header/lines type of object (think SalesTable/PurchTable), and on the header I have two calculated display methods, "total qty" and "total invoiced".
I want to add a simple display that says "Fully Invoiced", which is a display method that returns:
return this.TotalQty() == this.TotalInvoiced();
The issue is that calls the two display method calculations again, which could be performance hit on ListPages.
Is there a way to make a form method that uses the cached values so I don't have to call extra calculations and I don't have to create a table column?
As far as I know there is no way to access the values that have been cached for display methods in code.
You could define the display method on the table and use the existing caching mechanism. You would have to define the other two display methods totalQty
and totalInvoiced
on the table, too. Note that this will still result in some unnecessary calls to totalQty
and totalInvoiced
.
Another way would be to implement your own caching mechanism in the form by e.g. using a map that holds the RecIds and cache values (see Caching display methods on a form datasource for an example/tutorial). But if performance is more a theoretical than a practical problem, I would not recommend this approach.
A third option could be to combine the queries in totalQty
and totalInvoiced
into one query that is then used by the fullyInvoiced
display method. This will introduce some redundancy in your code and you would still have to define fullyInvoiced
on the table to leverage caching. But depending on the queries it could improve performance.