AMCO Coding Standard

ID for localisation and customisation
1. For Object *** 50000 up
2. For fields in page and table extensions.
Localized = 50000+
Customized = 60000+

Tables
1. Tables and table extensions should generally be in AMBase. This is to
allow data sharing between extensions - without multiple dependencies.

Tables' event handers may be in the appropriate extension project
rather than in the table.

Coding
1. Always use IF when calling GET() function
2. Scope prefix : z_ = function, local
p_ = parameter
m_ = variable, module (file-level)
3. Variable Prefix : g = text/code
e = option/enum
x = quantity
v = amount
r = rate/percent
q = boolean
d = datetime
i = integer
i, j, k = integer/counter
tbl, cu, pg, rpt, xml, qry, dur
4. Text Constants name must be upper-case e.g.
m_gERR_MESSAGE_Lbl: Label 'An error occurred';
Note: the compiler asks us to add a suffix such as "Lbl" labels etc.
5. Provide Thai language for new texts in translation file (.xlf)
6. Please use BEGIN-END for IF-ELSE / Loop
7. File header
//------------------------------------------------------------------------
// Name - Description
//
// Notes
// - Note 1
// - Note 2
//
// Changes
// [AM CG] 2018-05-08 : Created
//------------------------------------------------------------------------
8. Function Header
local procedure z_GetInvoice();
//------------------------------------------------------------------------
// [Description]
//
// Param: -
//
// Ret: -
//
// Note:
//------------------------------------------------------------------------
var
...
begin


9. Comment style
(a)
// [AM NH] Project: PQ/BR no.: Description
// Comment..
...
// [AM NH]

(b)
// [AM NH] Project: PQ/BR no.: Description
// Comment..
{ //Old
...
...
} //New
...
...
// [AM NH]
10. Only use FINDSET with REPEAT..UNTIL
11. Please try to follow the compiler's warnings/suggestions.

Report layout
1. Design to support Excel export (Merge, Amount)
2. Tablix header should not be at Header section.
Set repeat at tablix header instead.
3. Don't set length for text variable.
4. Put one-time filter at OnPredataItem() not AfterGetRecord().
5. Dont put textbox in rectangle !!! see Sales Vat
6. Test prining 2 pages or more.
7. Important reports (PDF/EXCEL/2PAGES)
- All Vouchers
- Purchase/Sales Vat
- PND 3/53 and Attachment
- Invoice / Credit Memo („∫≈¥Àπ’È) / Debit Note („∫‡æ‘Ë¡Àπ’È)
- Billing note
8. Basic mistake to check
8.1 Set Bottom Margin to 0.7
Last line was not printed completely (see FCA25525)
9. Set Report Property "Preview Mode" to "Print Layout"
10. To repeat tablix column header on new page **
- At the right most of Column Groups --> click at small triangle to enable "Advanced Mode"
- At Row Groups, click at (Static)
- At Propertis of Tablix member, set RepeatOnNewPage to True
11. For Pre-Print report, at Header, property 'CanGrow' must be FALSE, so layout would not be changed for long text (e.g. address).
12. For multiple document printing, beware of total, it should set sum on document no. group
13. In AfterGetRecord, if you use variable, always clear variable. To prevent unintentionally using last value.

Page
1. Filter in SourceTableView property is fixed and not shown.
2. Filter in OnOpenPage trigger will be default filter.
3. Set ShowFilter in page property to No, to block filter.
4. For pages that contain hug data (e.g. item ledger, items list)
Beware of adding calculated formula field as it will very slow when look up from another page.

Page and Report
1. You must set ApplicationArea if you want the page to appear in seacrch. Default : ApplicationArea = All;

Table
1. When adding new table, make sure it is included in a permission set and make sure that CS know and add permission on the new table. !!!

CHA folder
1. Same structure as \\NAVCode\Core
2. Use latest code (DEV) for OLD
3. When compare OLD-NEW, it must have only your changes
4. Capture screen (or pdf) for report or page change
5. Folder name format
normal fix >> FCA12345_NH, BR001_NH
followup fix >> FCA12345_F1_AD, BR001_F3_NH
relate problems fix >> BR009_010_NH

Spec
1. mini-spec must be printable in A4

Review
1. Check length of CODE that match with field length in table (e.g. No. (Customer) length = 20)

Data FixUp
1. Object Name must be in format AMFIXUP_<FCAxxx or BRxxx>
This help CS to know that this is AM object and can be deleted.
e.g. AMFIXUP_BR1002

Did you find this article useful?