Thursday 16 October 2014

using cacheAddMethod in display and edit methods


Display and edit methods are used on forms to display data that must be derived or calculated based
on other information in the underlying table. These methods can be written on either the table or the
form. By default, these methods are calculated one by one, and if there is a need to go to the server
when one of these methods runs, as there usually is, each function goes to the server individually. The fields associated with these methods are recalculated every time a refresh is triggered on the form, which can occur when a user edits fields, clicks menu items, or presses F5. Such a technique is expensive in both round trips and the number of calls placed to the database from the Application ObjectServer (AOS).

Caching cannot be performed for display and edit methods that are declared on the data source
for a form because the methods require access to the form metadata. If possible, you should move
these methods to the table. For display and edit methods that are declared on a table, use the
FormDataSource.cacheAddMethod method to enable caching.Caching cannot be performed for display and edit methods that are declared on the data source for a form because the methods require access to the form metadata. If possible, you should move these methods to the table. For display and edit methods that are declared on a table, use the FormDataSource.cacheAddMethod method to enable caching. This method allows the form’s engine to calculate all the necessary fields in one round trip to the server and then cache the results. To use cacheAddMethod, in the init method of a data source that uses display or edit methods, call cacheAddMethod on that data source and pass in the method string for the display or edit method.For example, look at the SalesLine data source of the SalesTable form. In the init method, you will

Example

public void init()
{
super();
salesLine_ds.cacheAddMethod(tableMethodStr(SalesLine, invoicedInTotal), false);
salesLine_ds.cacheAddMethod(tableMethodStr(SalesLine, deliveredInTotal), false);
salesLine_ds.cacheAddMethod(tableMethodStr(SalesLine, itemName), false);
salesLine_ds.cacheAddMethod(tableMethodStr(SalesLine, timeZoneSite), true);
}

No comments:

Post a Comment

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...