So I created a code extension to the InventItemPurchSetup table and created a mirror method of finding the lowest Qty to use in the ReqTranspo form inside a grid control(gridreqpo) I have rebuilt and it still doesn't recognize it. Is there something else special I need for it to access this method that I am not knowing about?
Ok... so the method is working. I threw some errors in there to display data. But the data doesn't post on the grid. Is there something special I need to set on that field? It only gives me the error with the information when I click on it.
Updated accordingly, no errors, but no data coming back. I am unable to debug until microsoft looks into the problem.
I am getting a warning, "BPErrorLabelIsText: BP Rule: [BPErrorLabelIsText:BPErrorLabelIsText: 'ReqPO' is not a label ID."
[ExtensionOf(formDataSourceStr(ReqTransPo,InventItemPurchSetup))] final class ReqTransPO_IPSetup_Extension { display public QtyLowest getMOQQty(InventItemPurchSetup _inventItemPurchSetup) { InventItemPurchSetup inventItemPurchSetupDefault; FormRun frun = this.formRun(); FormDataSource fds = frun.dataSource("ReqPO"); ReqPO reqpo = fds.cursor(); if (reqpo.ItemId) { inventItemPurchSetupDefault = InventItemPurchSetup::findDefault(reqpo.ItemId); if (inventItemPurchSetupDefault.RecId != reqpo.RecId) { return inventItemPurchSetupDefault.LowestQty; } } return 0; }
To get the ReqPo cursor you can try like below.
[ExtensionOf(formDataSourceStr(ReqTransPo,InventItemPurchSetup))] final class ReqTransPO_IPSetup_Extension { display public QtyLowest getMOQQty(InventItemPurchSetup _InventItemPurchSetup) { //get the formrun FormRun frun = this.formRun(); //get the form datasource FormDataSource fds = frun.datasource("ReqPo"); //get the current buffer ReqPo reqPo = fds.cursor(); } }
Thanks,
Girish S.
I was hoping to grab the current itemid from the row which is in reqpo. I won't know the itemid in the inventitempurchsetup.
You are adding a display method under InvenItemPurchSetup DataSource. But in the argument, you are passing ReqPO table buffer which is wrong. Thats the reason why you got the cast error. Change that to InventItemPurchSetup and check and also update the code accordingly.
Thanks,
Girish S.
So I adjusted it and added it the new call to the Datamethod on the field in the form and getting this error now.
////// class: ReqTransPO_IPSetup_Extension /// method: getMOQQty /// returns: Lowest Qty /// [ExtensionOf(formDataSourceStr(ReqTransPo,InventItemPurchSetup))] final class ReqTransPO_IPSetup_Extension { display public QtyLowest getMOQQty(ReqPO _reqpo) { InventItemPurchSetup inventItemPurchSetupDefault; if (_reqpo.ItemId) { inventItemPurchSetupDefault = InventItemPurchSetup::findDefault(_reqpo.ItemId); if (inventItemPurchSetupDefault.RecId != _reqpo.RecId) { return inventItemPurchSetupDefault.LowestQty; } } //if (_set) //{ //this.LowestQty = 0; //} return 0; } }
If the Datasource name doesn't work, try like below to get current cursor.
[ExtensionOf(formDataSourceStr(ReqTransPo,InventItemPurchSetup))] final class ReqTransPO_IPSetup_Extension { display public QtyLowest getMOQQty(ReqPO _reqpo) { InventItemPurchSetup inventItemPurchSetupDefault; //get the formrun FormRun frun = this.formRun(); //get the form datasource FormDataSource fds = frun.datasource("DataSourceName"); //get the current buffer TableName name = fds.cursor(); return 0; } }
Thanks,
Girish S.
Use DatasourceName.ItemId instead of this keyword.
Thanks,
Girish S.
Ok, so I think I got this added semi correctly.. I need to get the lowest qty from InventItemPurchSetup based on the ReqPo line itemid. It doesn't like the this variable.
[ExtensionOf(formDataSourceStr(ReqTransPo,InventItemPurchSetup))] final class ReqTransPO_IPSetup_Extension { display public QtyLowest getMOQQty(ReqPO _reqpo) { InventItemPurchSetup inventItemPurchSetupDefault; if (this.ItemId) { inventItemPurchSetupDefault = InventItemPurchSetup::findDefault(this.ItemId); if (inventItemPurchSetupDefault.RecId != this.RecId) { return inventItemPurchSetupDefault.LowestQty; } } return 0; } }
André Arnaud de Cal...
291,971
Super User 2025 Season 1
Martin Dráb
230,846
Most Valuable Professional
nmaenpaa
101,156