Hi All,
I got a request from a customer who wishes to hide a unit of measurement option from certain items. The issue here being that the unit of measure that needs to be disabled from use already has item ledger entries. For some reason they do not want to create a new item. For all outbound documents they want to be able to hide a certain unit of measure for a specific item or items.
My approach was:
- Extend the item unit of measure table with a boolean field called Hide
- Extend the Page Item units of Measure with the same field
- Extend Table 37-Sales Line Table - on field 5407-Unit of Measure Code [10]. By changing the table relation property
To my understanding this should be enough to manipulate the lookup behaviour on the Saler Orders Page from with the Sales Lines Sub Form.
here is my table relation Code:
if (Type = const(Item)No. = filter(<> '')) Item Unit of Measure Code where(Item No. = field(/No.))if (Type = const(Item)No. = filter(<> '')) Item Unit of Measure Code where(Item No. = field(/No.), Hide = const(false))
In the edited code I added the /Hide = Const(false)/ into code. I would expect that when looking up the Item unit of measure from the /Unit Of Measure Code/ field on the Sales Line Page, it nof only filters on the /Item No./ = field(/No./), but also on the Hide = Const(false)) field. This does not seem to take effect.
Any suggestions and help would be much appreciated. The only thing I am still considering is trying to Modify the OnLookUp trigger on the Unit Of Measure Code field on the Sales Order Subform, which has the Sales Line Table as a source. However, I have no idea on what code or logic I should be adding there when I already edited the table relation property for the Unit of Measure Code field on the source table.
Update:
The code formatter displays the code in a weird way. Here is the code without the code editor:
if (Type = const(Item),
No. = filter(<> '')) Item Unit of Measure.Code where(Item No. = field(No.))
else
if (Type = const(Resource),
No. = filter(<> '')) Resource Unit of Measure.Code where(Resource No. = field(No.))
else
if (Type = filter(/Charge (Item)/ | /Fixed Asset/ | /G/L Account/)) /Unit of Measure/
--Edited Code
if (Type = const(Item),
No. = filter(<> '')) Item Unit of Measure.Code where(Item No. = field(No.), Hide = const(false))
else
if (Type = const(Resource),
/No./ = filter(<> '')) /Resource Unit of Measure/.Code where(/Resource No./ = field(/No./))
else
if (Type = filter(/Charge (Item)/ | /Fixed Asset/ | /G/L Account/)) /Unit of Measure/;