Problem with Validating Madatory feild ???/

southindiansouthindian Member Posts: 247
Dear all....

Am trying to validate madatory feilds by writing the code in ONinsert trigger in the table

*******************

IF "Costing Option" IN ["Costing Option" :: "Suggested Profit %","Costing Option" :: "Dividend Factor",
"Costing Option" :: "General Establishment Expenses",
"Costing Option" :: "Spec. Establishment Expenses"] THEN
BEGIN
IF "Unit Code" ='' THEN BEGIN
ERROR('The Unit Code cannot be empty for the specific costing Option','%1',"Costing Option");
END;
IF "Value / Percentage" =0 THEN BEGIN
ERROR('The Value / Percentage cannot be empty for the specific costing Option','%1',"Costing Option");
END;


END
ELSE
//IF "Costing Option" = "Costing Option" :: "Weight Variation" THEN *** blocked by vijayEAI in 18-05-10
// 004 *** ADDED by vijayEAI in 18-05-10
IF "Costing Option" IN ["Costing Option" :: "weight Variation",
"Costing Option" :: "Family Mould"] THEN
// 004 *** ADDED by vijayEAI in 18-05-10
BEGIN
TESTFIELD(Type);
TESTFIELD("No.");
END
ELSE
IF "Costing Option" IN ["Costing Option" :: "RM Cost","Costing Option" :: "Assembly Cost",
"Costing Option" :: "Fabrication Cost"] THEN
BEGIN
TESTFIELD("Location Code");
TESTFIELD(Type);
TESTFIELD("No.");
END
ELSE
IF "Costing Option" IN ["Costing Option" :: "Int on Cap Invt (Allocable)","Costing Option" :: "Int on Cap Invt (UnAllocable)",
"Costing Option" :: "Dep on Cap Asset (Allocable)",
"Costing Option" :: "Dep on Cap Asset (UnAllocable)","Costing Option" :: "Ins on Cap Asset (Allocable)",
"Costing Option" :: "Ins on Cap Asset (UnAllocable)","Costing Option" :: "Mould / Dies Depreciation",
"Costing Option" :: "Direct Labour Charges","Costing Option" :: "Indirect Labour Charges",
"Costing Option" :: "Direct Overheads","Costing Option" :: "Interest on Working Capital (RM)",
"Costing Option" :: "Electricity Cost","Costing Option" :: Maintenance,
"Costing Option" :: "Building Maintenance","Costing Option" :: "Suggested Profit %",
"Costing Option" :: "Dividend Factor","Costing Option" :: "Indirect Overheads",
"Costing Option" :: "Interest on Working Capital (FG)",
"Costing Option" :: "Interest on Working Capital (Rec)",
"Costing Option" :: "Interest on Working Capital (Dir Expense)",
"Costing Option" :: "Interest on Working Capital (Indr Expense)"] THEN

BEGIN
TESTFIELD("Unit Code");
TESTFIELD("G/L Account Nos");
END


***********************************


The problem here am facing is before entring all the records in the line, the ONinsert trigger is getting triggered and it is checking for valldation and abviously it is trowing error for the feild which had not entered.

Can anyone can give solution for my problem.

Comments

Sign In or Register to comment.