Discussion of Mandatory fields

Michael_Krause
Member Posts: 10
To create mandatory fields in NF there are three concepts I have tested, all with some bad effects:
1. Using the OnInsert or OnModify Trigger. If you enter values in several fields and one mandatory field is missing all input is reseted. You have to type all fields again. <img border="0" title="" alt="" src="images/smiles/icon_sad.gif" />
2. Using the NotBlank Trigger. You have to set up a default value. In some cases you can't set up a good default value. <img border="0" title="" alt="" src="images/smiles/icon_sad.gif" />
3. The NF Help File suggest to use the BeforePutRecord trigger on the form. If you use this the form allways closes if an error occurres. <img border="0" title="" alt="" src="images/smiles/icon_sad.gif" />
Any better ideas? How do you handle mandatory fields?
Do you use any standars in your projects?
Best wishes for Millenium.
1. Using the OnInsert or OnModify Trigger. If you enter values in several fields and one mandatory field is missing all input is reseted. You have to type all fields again. <img border="0" title="" alt="" src="images/smiles/icon_sad.gif" />
2. Using the NotBlank Trigger. You have to set up a default value. In some cases you can't set up a good default value. <img border="0" title="" alt="" src="images/smiles/icon_sad.gif" />
3. The NF Help File suggest to use the BeforePutRecord trigger on the form. If you use this the form allways closes if an error occurres. <img border="0" title="" alt="" src="images/smiles/icon_sad.gif" />
Any better ideas? How do you handle mandatory fields?
Do you use any standars in your projects?
Best wishes for Millenium.
Regards
Michael Krause
Michael Krause
0
Comments
-
That is correct.
NotBlank should only be used for Key Fields.
One way of doing it, would be to on the form (yark), and on the field - Give it a name (View - Properties - Name) press F9 - OnDeactivate you could do the following:
if <Fieldname> = '' then begin
message('You MUST place a value in %1,fieldname(<Fieldname>);
currform.mand1.activate();
end;
Kind regards
Henrik Helgesen0 -
Another way is to use the forms OnModifyRecord / OnInsertRecord triggers. If the data does not pass the check, you display a message for a user and return false as a result. That way the data will be retained and the input can't be accomplished before the data is correct.
Urmas Pill
urmas.pill@rlk.ee0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K 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
- 320 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