The first time I did this, I over-complicated it. I wasn’t sure how to write a complicated SQL query so I create a Query object, then a View object that saw that query, and then a data Method that pulled that “record” and a display Method that pushed the field to the grid.
Yeah, over-complicated.
Here is a cleaner way to do it.
On the primary table for the form, add a method that generates the value.
In the Design of the Form, add an appropriate field.
In this case it was a Date field.
Set the DataSource to the table, and instead of assigning a DataField you assign the DataMethod to the method you wrote.
Unfortunately, a calculated field can’t be sorted by or filtered by, so I have to build it directly into the table (third time is a charm!)






No comments:
Post a Comment