I'm new to x++ so I'm trying pick this up as I go.
I duplicated the InventOnHandItem form so that I can have customized copy.
I've learned that I won't be able to get the InventDimID from a method on the form because the data is summed.
I figured I could create a method on InventSum to return data that I want. I want to create a field that goes to InventTrans and sums the qty based on ItemID and InventDimID...
display Qty physicalReservedNT()
{
InventTrans _inventTrans;
;
select sum(qty) from _inventTrans
index DimIdIdx
group by _inventTrans.ItemId, _inventTrans.inventDimId
where _inventTrans.StatusIssue == Statusissue::ReservPhysical &&
_inventTrans.TransType == InventTransType::InventTransfer &&
_inventTrans.ItemId == this.ItemId &&
_inventTrans.inventDimId == this.InventDimId;
return abs(_inventTrans.Qty);
//return this.availOrdered();
}
When I step through the code, the InventDimID is blank for any item I use. From the InventSum table methods, how can I get InventDimID?
*This post is locked for comments
Any luck bombtrk? I am also in a similar situation. InventDimId always blank how to get the values in InventDimId.
I have similar problem.
community.dynamics.com/.../87175.aspx
I found two people reporting, that they manage to cope with this kind of problem by writing display methods directly on table. But I didn`t have luck on this...
One example (taken from objectmix.com/.../788694-display-method-2-datasources-input.html) of geting configId on this form:
>You can get all the info from InventSum.
Create a new display method on InventSum table.
You will get the ItemId from InventSum directly, and you can get ConfigId
from InventDim, which you can get through InventSum, for example like the
following
(assuming this is a method on InventSum table, as I suggested above):
ConfigTable::find(this.ItemId, this.inventDim().ConfigId)
This is what I have so far. It's on the InventSum table. I want to go and sum up data from InventTrans without Transfers.
I can get the InventOnHandItem form to display this field, but when I step through the code, the InventDimID is blank. Why is that? What am I missing?
//BP Deviation documented
display Qty physicalReservedNT()
{
InventTrans _inventTrans;
InventSum _inventSum;
InventDim dim;
;
if(!this.InventDimId)
{
dim = InventDim::findDim(this.inventDim());
if(dim.InventDimId)
_inventSum.InventDimId = dim.InventDimId;
}
select sum(qty) from _inventTrans
index DimIdIdx
group by _inventTrans.ItemId, _inventTrans.inventDimId
where _inventTrans.StatusIssue == Statusissue::ReservPhysical &&
_inventTrans.TransType != InventTransType::InventTransfer &&
_inventTrans.ItemId == this.ItemId &&
_inventTrans.inventDimId == dim.inventDimId;
return abs(_inventTrans.Qty);
}
I've tested this code from the InventSum table and the InventOnHandItem form but when I step through the code, the InventDimID is always blank...
What am I missing here?
Hi,
You can write a display method on the form's datasource level but the problem with doing that is the active record is only calculated. As soon as you switch off the active record, the display method is recalculated and displayed.
So if you have two warehouses with on hand qty for an item, the following display method will work for the active record within the InventOnHandItem form.
Try putting this check in your inventSum table display method:
if(!_inventSum.InventDimId)
{
dim = InventDim::findDim(this.inventDim());
if(dim.InventDimId)
_inventSum.InventDimId = dim.InventDimId;
}
Mohamed Amine Mahmoudi
100
Super User 2025 Season 1
Community Member
48
Zain Mehmood
6
Moderator