AX2009 - Show value in a field from a related table

I have a field called ‘DS72’ which I have added to the InventTable in AX 2009. The field is related to another custom table related by the ItemId field. I have added the field to the InventTable form but when I assign a value to my ‘DS72’ field in my custom table to an item, the value doesn’t show in the InventTable form.

I have instead replaced this with a display method but the downside to that is I can’t filter the results or Right Click > Go to Main Table.

When I add the new table as a datasource to the InventTable form and then drag the DS72 field across, it seems to create a new empty, entry in my new table whenever I try to save a record in the InventTable and this causes an error:

Cannot create a record in DS72 (DS72). DS72: .

The record already exists.

Is there another way I can achieve this?

It all depends on what you need. You could join the two tables to allow filtering (that’s usually the preferred way). You could do the same in view. You could add code to update() method (and insert() and delete() too, if needed) to update InventTable if the value changes in you table.

Hi Martin,

When I add my new table as a datasource and set the join type as outerjoin (this is so those items without a DS72 number will also appear as it’s not mandatory). It seems to create a new entry in my table so I am unable to edit any record in the InventTable. I have edited my question to show the error

You can change write() and validateWrite() on the datasource as per your needs.

Can’t I create a new field in the InventTable and setup a relation between that field and the field in my new table? So that way the values are linked? I tried this but the value was empty in the InventTable so I’m not sure if I done it correctly or not

Basically, I just want the value to appear in the InventTable if the item associated with it contains a value. As I said, I got this to work with a display method but I thought there may be a better way? So that I can actually go to the main table from the InventTable form which a display method doesn’t allow.

You can denormalize the database and have the field in both tables, but they won’t synchronize by themselves. You have to update InventTable when you table changes, as I mentioned in my first answer.

Ah, I don’t want to de-normalise the data… so I guess my best bet is to keep the display method? Not sure how else I can do this…