joinaxaptasqldatasourcedynamics-ax-2009

display method in grid is showing the same text in all rows


I have a very simple display method on a table to display the weekday of a given date:

display DateDayName day()
{
    WeekDays    weekday;
    ;
    weekday = dayofwk(this.TransDate);

    return enum2str(weekday);
}

but for some reason when I use this method on a grid on a specific form the displayed text uses the first record for all lines in the grid and when a new line is selected the selected line is updated with the correct text and the prevoiusly selected record gets updated with the value of the newly selected record.

Issue image 1 Issue image 2

As can be seen, the datasource is linked to another datasource but it looks like it has been set up correctly. I have tried various settings for datasource and linktype but it hasn't helped or changed anything


Solution

  • I just found the answer myself immediately after posting. I was about to try to change the display method to being on the forms datasource instead of being on the table when I found that it was already there with the same name. This was probably causing problems for axapta in choosing which method to read as it is the default place to look for display methods if the datasource is not specified. I simply changed the name of the method on the datasource and all was fine.