Problem with Validating Madatory feild ???/
southindian
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.
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.
0
Comments
-
did you try the delayedinsert property of the form?0
-
Thank you very much sir... it is working0
-
glad it worked. please edit the first post and set the attribute to solved. :thumbsup:0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 326 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions