Bizarre form behavior--has anyone seen this?

This question is answered

Before we went live with AX2012 R2, a colleague of mine added the SalesLine table as a data source to the WMSOrder table and added three fields to display the City, State and ZIP of the customer who the output order is for. The SalesTable and CustTable were also added to display the customer name and if available, the external item Id of what was ordered. All of the new controls are in the grid.

The customer name and external item id fields are working as designed. However, when the form loads, the city, state and zip fields show the same value regardless of who the customer is. When the form is loaded, the first record on the form's address data is displayed for all of the records in the grid. Then if you start moving through the records it gets really bizarre--changing from the original value to a different value. I can not seem to get the logic behind the updates.

The three new controls that are displaying improperly are all calling the SalesLine.deliveryAddress() method and calling the indivdual field records of whatever that method returns.

I tried to do an end around on it by writing a method on the WMSOrder datasource (which is part of the core design of the form) by doing a select statement that found the SalesLine record with the same InventTransId as WMSOrder, but the behavior was the same.

Has anyone else seen behavior like this? I searched the forums and didn't see anything.   If anyone has any suggestions, or knows this is actually a bug, please let me know. Thanks.

Brandt

Verified Answer
  • If you implement a display method on a datasource, you have to pass (and use) the actual buffer for which the value is to be calculated. If you just refer to the current form buffer, you'll get the same value for all lines, because the method refers to a single buffer.

    Check out an example on Axaptapedia.

    Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

All Replies
  • If the three controls are based on display methods implemented on the form, may they don't use the buffer received from parameter. Or maybe SalesLine is not joined correctly to WMSOrder.

    Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

  • Martin,

    The join is correct...I have confirmed it myself. However, you may be on to the display method. My co-worker did not pass a parameter to the display method. Should we be passing the table buffer as a parameter? How do we do that for a method added to the form data source?

    Thanks for your response.

    Brandt

  • If you implement a display method on a datasource, you have to pass (and use) the actual buffer for which the value is to be calculated. If you just refer to the current form buffer, you'll get the same value for all lines, because the method refers to a single buffer.

    Check out an example on Axaptapedia.

    Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

  • Martin,

    I had forgotten about passing the parameter in the datasource method (I haven't done it in about two years.) Thanks for pointing me to that link. And thanks for helping us solve this.

    Brandt