Validating data of a table and giving warning upon clicking a button
On click of a button :-
[Control("Button")]
class BASValidateButton
{
/// <summary>
///
/// </summary>
public void clicked()
{
BASPurchaseOrderEntity purch;//,notVendor;
while select * from purch
{
VendTable vendTable;
InventTable inventTable;
InventDim inventDim;
//validation for Vendor
select count(RecId) from vendTable
where vendTable.AccountNum == purch.VendorAccount;
if(vendTable.RecId==0)
{
warning(strFmt('Vendor Account %1 is not available',purch.VendorAccount));
}
//validation for item
select count(RecId) from inventTable
where inventTable.ItemId == purch.ItemNumber;
if(inventTable.RecId==0)
{
warning(strFmt('Item Number %1 is not available',purch.ItemNumber));
}
//validation for site
select count(RecId) from inventDim
where inventDim.InventSiteId == purch.Site;
if(inventDim.RecId==0)
{
warning(strFmt('Site %1 is not available',purch.Site));
}
//validation for warehouse
select count(RecId) from inventDim
where inventDim.inventLocationId == purch.Warehouse;
if(inventDim.RecId==0)
{
warning(strFmt('Warehouse %1 is not available',purch.Warehouse));
}
//Refresh the form data source upon clicking
BAS_CreatePurchaseOrder_ds.research();
BAS_CreatePurchaseOrder_ds.refresh();
}
super();
}
}
Comments
Post a Comment