Lazy Programmers

Marije_Brummel
Member, Moderators Design Patterns Posts: 4,262
Hi,
For all people who want clean programming but do not want to put in loads of text
If you compile
It will generate
Same goes for reports and dataports etc.
Optionstrings:
Makes
After compiling
Thanks to Alain Krikilion for the form::"1" tip
For all people who want clean programming but do not want to put in loads of text
If you compile
Form.runmodal(form::form1)OR
Form.runmodal(form::"1")
It will generate
Form.runmodal(form::"Company Information")
Same goes for reports and dataports etc.
Optionstrings:
SalesLine.Type := SalesLine.Type::"2";
Makes
SalesLine.Type := SalesLine.Type::Item;
After compiling
Thanks to Alain Krikilion for the form::"1" tip

0
Comments
-
You can also type
Cust.Field1;
Compiler makes:Cust."No.";
0 -
Mark Brummel wrote:You can also type
Cust.Field1;
Compiler makes:Cust."No.";
or alsoCust."1"
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
If you have a field called "Table No." in your table and you want to check the value, many people use
CASE Rec."Table No." OF 36: [...] 37: [...] 38: [...] 39: [...] END;
It is better to writeCASE Rec."Table No." OF DATABASE::"Sales Header": [...] DATABASE::"Sales Line": [...] DATABASE::"Purchase Header": [...] DATABASE::"Purchase Line": [...] END;
This also works with the trickCASE Rec."Table No." OF DATABASE::"36": [...] DATABASE::"37": [...] DATABASE::"38": [...] DATABASE::"39": [...] END;
The compiler converts it into the correct code.Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
You can do this also with Option Fields:
Optionfield = Salesperson/Team,Class,Main Group,Material Group,Info Group,Item
VarOpt := Optionfield::S;
VarOpt := Optionfield::c;
VarOpt := Optionfield::"Mai";
VarOpt := Optionfield::"Mat";
VarOpt := Optionfield::"in";
VarOpt := Optionfield::"it";
RegardsDo you make it right, it works too!0
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