How to Caching Display Methods - New Way Of Caching

Rumman Ansari   Software Engineer   2024-06-26 07:02:33   69  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

Speaking about the display method caching, there are other ways to do this. One of the ways is to place the SysClientCacheDataMethodAttribute attribute at the top of the display method, as shown in the following code snippet:


    [SysClientCacheDataMethodAttribute] 
    display Description displayPaymTermDescription() 
    { 
       return (select firstOnly Description from PaymTerm
       where PaymTerm.PaymTermId == this.PaymTermId).Description; 
    } 

In this case, the method will automatically be cached on any form where it is used without any additional code.

Another way is to change the CacheDataMethod property of the form's control to Yes. This will have the same effect as using the cacheAddMethod() method or the SysClientCacheDataMethodAttribute attribute.


There's more...

Display methods can be used in Lookup methods as well. However, you will not be able to perform any sorting and filtering in this field. Using the following code syntax, you can add a new field in Lookup using a display method:


 sysTableLookup.addLookupMethod(tableMethodStr(TableName, MethodName)); 

You can add this in your Lookup method right after all your physical fields.