Display Method when no direct relation exists


I have a requirement to add InventDimCombination.RetailVariantID in various forms across AX. 

All these forms/Datasources are related to InventDim table. And the InventDimCombination is also related with InventDim.

How do I write a display method on the various form's data sources, such that I can use the relation with InventDim table to get the Variant ID? 

I was trying to do something as shown below, but it doesnt seem to work. 

display RetailVariantId Variant()
InventDim inventDim;
InventDimCombination inventDimCombination;
PriceDiscAdmTrans priceDiscAdmTrans;

select RetailVariantId from inventDimCombination
join InventDim
where inventDimCombination.InventDimId == InventDim.InventDimId
Join PriceDiscAdmTrans
where inventDim.InventDimId == this.InventDimId;

return inventDimCombination.RetailVariantId;

  • InventDimId on InventDimCombination is different. It will be build only with product dimension, but not the storage and tracking dimensions.

    I think you can use the existing method, \Data Dictionary\Tables\InventDimCombination\Methods\findByInventDim