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)

How to optimize call to display method?

(0) ShareShare
ReportReport
Posted on by

Hello,

I have a display method on a table, that makes calls to several other tables. In forms grid I have field, that uses this display method. I also have cached this method on datasources init. Problem starts when I want to change color of some of the grid lines, where this field(that uses display method) is for example 0. So in datasources displayOption method I have a check that calls this display method once again for every line and checks if it returns 0 and it happens every time I refresh form.

0216.Capture3.JPG

Is there any way not to use this display method again or without need?

I thought of maybe adding a check to display method, where I would ask who called this method and if it's my form, then try to change color of that line. Or maybe making a map, that on the forms init I would fill with id and value from display method, so in the init it would call this display method twice for every line(to draw grid and fill my map), but afterwards on displayOption I could search for values in map.

But it seems that none of those choices would be good or improve performance.

Do you have any suggestions how to improve performance on this situation?

Regards

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: How to optimize call to display method?

    that makes sense, thank you!

  • Verified answer
    Martin Dráb Profile Picture
    235,876 Most Valuable Professional on at
    RE: How to optimize call to display method?

    If you want to build it up front for all lines, you should rather use a temporary table.

    The idea of local cache is that when a display method is called (for a particular record), you calculate the value and put it into cache (implemented by a Map, for example). When the method is called again, you return the cached value.

    Obviously, you don't ever do anything for lines that don't get displayed. If you display 20 lines, you'll have twenty values in cache, even if the table has million records.

  • Community Member Profile Picture
    on at
    RE: How to optimize call to display method?

    I tried making map, but it takes a long time to fill it, because I  need to put there not only values from display method, but also some identificator from the Table, so I need to read through this Table and unfortunately this Table has a lot of lines, so it takes forever to go through all of them.

    I will try your suggestion.

  • Martin Dráb Profile Picture
    235,876 Most Valuable Professional on at
    RE: How to optimize call to display method?

    Why do you think that using local cache (with a map) wouldn't improve performance?

    Other options include replacing the display method with joined data sources, rewriting it to a computed column, putting calculated values to a temporary table and maintaining the value as a normal field.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans