Good day,
I am attempting to create a custom form to display the ItemId from the InventTable and the relevant item's image from the EcoResProductImage table in grid format using a Window control for the image.
On the form methods I have the following code:
public void showImage() { Image itemImage; ; productImageRecId = InventTable::find(InventTable.ItemID).RecId; if(productImageRecId) { select ecoResProductImage where ecoResProductImage.RefRecId == productImageRecId || ecoResProductImage.RefRecord == productImageRecId; containerImage = ecoResProductImage.ThumbnailSize; itemImage = new Image(); itemImage.setData(containerImage); Image.image(itemImage); image.widthValue(itemImage.width()); image.heightValue(itemImage.height()); } }
and in the form data source I have the InventTable with an Active method with the following code:
public int active() { int ret; ret = super(); element.showImage(); return ret; }
This does produce a form that displays the item and image but only when I select each individual line. I know this is because of the active method, and I know that I would need to rather create a display method on the form data source so that it displays all images when the form opens. What I am unsure about is what to select and what to return in the display method. I can use the same select statement I used in the showImage() method but I do not know what to return then.
I have attempted to use the CompanyImage form and its code as reference but I have been unsuccessful.
I am fairly new to AX dev and dev in general so any guidance would be much appreciated.
Thank you in advance.