Create methode parameter in Dynamics AX Table using x++ :
Cara membuat parameter local dari tabel itu sendiri saat
diisi di form
static boolean validateRow(ItemId _item)
{
RUM_MasterProjectLines _RUM_MasterProjectLines;
InventDim _inventDim;
boolean result;
result = false;
if(_item)
{
select
firstOnly _RUM_MasterProjectLines where _RUM_MasterProjectLines.ItemNumber ==
_item;
select
_inventDim where
_RUM_MasterProjectLines.InventDimId == _inventDim.inventDimId;
InventDim::BITValidateRow(_inventDim.InventSiteId,
_inventDim.InventLocationId, _inventDim.configId);
if(!_RUM_MasterProjectLines.RecId)
{
result = true;
}
}
return
result;
}
Cara Panggil di Form
public boolean validate()
{
boolean
ret;
ret = super();
if(RUM_MasterProjectLines.ItemNumber)// && Inventdim.InventSiteId &&
InventDim.InventLocationId && inventdim.configId)
{
if(!RUM_MasterProjectLines::validateRow(RUM_MasterProjectLines.ItemNumber))
{
info(strFmt("Item Number : %1 ada yang sama",
RUM_MasterProjectLines.ItemNumber));
ret = false;
}
}
return
ret;
}
static boolean validateNewRow(
ItemId _item,
InventSiteId _site,
InventLocationId _warehouse,
EcoResItemConfigurationName _config
)
{
RUM_MasterProjectLines _RUM_MasterProjectLines;
boolean result;
result = false;
if(_item
&& _site && _warehouse && _config)
{
select
firstOnly _RUM_MasterProjectLines
where
_RUM_MasterProjectLines.ItemNumber == _item &&
_RUM_MasterProjectLines.site == _site
&&
_RUM_MasterProjectLines.Warehouse == _warehouse &&
_RUM_MasterProjectLines.configId == _config;
if(!_RUM_MasterProjectLines.RecId)
{
result = true;
}
}
return
result;
}
static boolean BITValidateRow(
InventSiteID _Site,
InventLocationID _warehouse,
EcoresitemConfigurationName _configID
)
{
InventDim _InventDim;
boolean
ret;
ret = false;
if(_Site
&& _warehouse && _configID)
{
select
firstOnly _InventDim
where
_InventDim.InventSiteId == _Site
&&
_InventDim.InventLocationId == _warehouse
&&
_InventDim.configId == _configID;
if(!_inventdim.RecId)
{
ret = true;
}
}
return
ret;
}
Cara panggil di Form
public boolean validate()
{
boolean
ret;
ret = super();
if(RUM_MasterProjectLines.ItemNumber
&& Inventdim.InventSiteId && InventDim.InventLocationId
&& InventDim.configId)
{
if(!RUM_masterProjectLines::validateRow(RUM_MasterProjectLines.ItemNumber))//,
Inventdim.InventSiteId, InventDim.InventLocationId, InventDim.configId))
{
error(strFmt("Config : %1 ada yang sama",
RUM_MasterProjectLines.configId));
ret = false;
}
}
return
ret;
}
public boolean validate()
{
boolean
ret;
ret = super();
if(RUM_MasterProjectLines.ItemNumber
&& inventdim.InventSiteId && InventDim.InventLocationId
&& InventDim.configId)
{
if(!RUM_MasterProjectLines::validateRow(RUM_MasterProjectLines.ItemNumber))//, inventdim.InventSiteId,
InventDim.InventLocationId, InventDim.configId))
{
info(strFmt("Site : %1 ada yang sama",
inventdim.InventSiteId));
ret = false;
}
}
return
ret;
}
public boolean validate()
{
boolean
ret;
ret = super();
if(RUM_MasterProjectLines.ItemNumber
&& inventdim.InventSiteId && InventDim.InventLocationId
&& InventDim.configId)
{
if(!RUM_MasterProjectLines::validateRow(RUM_MasterProjectLines.ItemNumber))//, inventdim.InventSiteId,
InventDim.InventLocationId, InventDim.configId))
{
error(strFmt("Warehouse : %1 ada yang sama",
inventdim.InventLocationId));
ret = false;
}
}
return
ret;
}
0 comments:
Post a Comment