This post will take the assumption that we are creating a new display method and referencing it to an existing form. So basically showing beginning to end stuff.
Note: Using cacheAddMethod for a field will not allow you to filter this field; it is display/informational only
Note: Using cacheAddMethod can cause the grid functionality to move slower so be cognizant of using this in excess.
- Create a display method on the table that is the datasource on the grid of interest (could be primary). For instance, if the grid in the form was showing sales line information, we are going to create a new method on the table (not the form or datasource; the table itself). It might look like the below in Figure 1. It can have whatever in it but it will need to return something. This will be the value you see in the grid
- Reference this display method on the form's datasource's init method after the super. See Figure 2 below. Notice the use of 'tableMethodStr'. The first parameter is the table that we added a method to in Step 1 and the second parameter is the display method name we created from Step 1.
- Add a field (of the correct data type) to the grid. Reference the correct datasource and put hte name of the table method added in Step 1. See Figure 3 below.
public display salesQty daxSalesQtyReferenced() { return
this.InventTransId ?
this.invoicedInTotalServer() : 0; }
Figure 1 - Display method on the table
void init()
{
;
super();
salesLine_ds.cacheAddMethod(tableMethodStr(SalesLine, daxSalesQtyReferenced));
}
Figure 2 - The display method in the datasource of the grid after the super call
Figure 3 - Add a field to the grid and referenced the new cached method in the DataMethod field
No comments:
Post a Comment