web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Problem with caching the display method on Form

(0) ShareShare
ReportReport
Posted on by 4,624

Hi,

I am using a display method(written on salesTable) on salesorder form. And i have cached it on salesTable formdatasource init() method. I have lookup field along with this display field on form. But display field value is populated or changed once  press ctrl+S or switch to line view or Header view. 

  on the other side, if i am not using caching on form , display field value is populated or changed once i move cursor to next field or other field.

 is it expected behavior of caching ? looking for your suggestions on this.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Problem with caching the display method on Form

    Hi Visvash Walia,

    Second parameter of FormDataSource.cacheAddMethod determines if values is refreshed on record write and by default is true. Whenever you press ctr+s it saves the record and switch to header does the same - save, it triggers update of display method, so it's expected behavior.

    If you don't want to refresh it on save  set parameter to false. Or if you want to refresh it on modify of another field add call to cacheCalculateMethod() method to modifiedField.

  • Rohin Profile Picture
    4,624 on at
    RE: Problem with caching the display method on Form

    Thanks Ievgen,

     I called formdatasource.cacheCalculateMethod() on another field formdatasource modfied() method before super(), but its behavior is same as without caching means it get refreshed on moving cursor to next records .. is it correct?

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: Problem with caching the display method on Form

    So cacheCalculateMethod() will refresh cache if you modify that field, if you wont change it cache wont be refreshed as well. If you don't want to refresh cache on moving to the next record\save then pass false to  cacheAddMethod  as a second parameter.

  • Rohin Profile Picture
    4,624 on at
    RE: Problem with caching the display method on Form

    Well.. I am finding the way if i changed the lookup field then the display field (caching field ) should changed without moving to next record /save .

  • Mea_ Profile Picture
    60,284 on at
    RE: Problem with caching the display method on Form

    I'm not quite sure what is your problem now, did cacheCalculateMethod() help you or not ?

  • Rohin Profile Picture
    4,624 on at
    RE: Problem with caching the display method on Form

    Well Ievgen, its working well as it was for without using caching means display field is refreshed/ changed on moving to next record. What I want is there any other way to change the field once modified the another field , without move to next record?

  • Community Member Profile Picture
    on at
    RE: Problem with caching the display method on Form

    Hi

    Sometimes i have similar problem.

    This code PurchTable_DS.cacheCalculateMethod(tableMethodStr(PurchTable, MyMethod)); run manual update only, after record was saved and if you turned off auto refreshing in the cacheAddMethod.

    I found that works only this solution

    public void modified()
    {
    super();


    purchTable_ds.refresh();

    element.modifiedDataSourceFieldSetAccess();

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans