Restructure for Docsy theme

This commit is contained in:
Jeremy Vyska 2022-02-20 13:18:49 +01:00
parent f4a1ebc077
commit cceb0c945e
376 changed files with 963 additions and 186 deletions

View file

@ -0,0 +1,9 @@
+++
title = "Localizability"
weight = 750
+++
## C/AL Coding Guidelines
## **Localizability**
Find the C/AL guidelines by expanding the menu in the left.

View file

@ -0,0 +1,26 @@
+++
title = "CaptionML on System Pages"
weight = 300
+++
CaptionML should always be specified on a page field for a system table. By default, system tables do not have captions, so if you need to use them in the UI then captions need to be added.
Bad code
...
{ 2 ;2 ;Field ;
SourceExpr=Name }
...
OBJECT Table 2000000000 User
...
{ 2 ; ;Name ;Text50 }
Good code
...
{ 2 ;2 ;Field ;
CaptionML=ENU=Name;
SourceExpr=Name }
...
OBJECT Table 2000000000 User
...
{ 2 ; ;Name ;Text50 }

View file

@ -0,0 +1,22 @@
+++
title = "FIELDCAPTION and TABLECAPTION"
weight = 580
+++
For user messages, errors etc., use FIELDCAPTION not FIELDNAME and TABLECAPTION not TABLENAME.
Reason:
1. The correct translation will be automatically used.
2. If the caption/name changes, then there will be a single point of change needed.
Bad code
```al
IF NOT CONFIRM(UpdateLocationQst,TRUE,FIELDNAME("Location Code"),...)
```
Good code
```al
IF NOT CONFIRM(UpdateLocationQst,TRUE,FIELDCAPTION("Location Code"),...)
```

View file

@ -0,0 +1,24 @@
+++
title = "Global Text Constants"
weight = 610
+++
Declare Text Constant as global variables.
Bad code
```al
PROCEDURE GetRequirementText@6(...) : Text[50];
VAR
RequirementOptionsTxt@1002 : TextConst 'ENU=Shipment,Receive,Pick,Put-Away';
BEGIN
```
Good code
```al
VAR
RequirementOptionsTxt@1002 : TextConst 'ENU=Shipment,Receive,Pick,Put-Away';
...
PROCEDURE GetRequirementText@6(...) : Text[50];
BEGIN
```

View file

@ -0,0 +1,45 @@
+++
title = "Use Text Constants"
weight = 1360
+++
Pass user messages using Text Constants. It makes translation easy.
Bad code
```al
ImportAttachmentQst@1021 : TextConst 'ENU="Import attachment "';
...
IF CONFIRM(ImportAttachmentQst + Caption +'?',TRUE) THEN BEGIN
```
Good code
```al
ImportAttachmentQst@1021 : TextConst 'ENU="Import attachment %1?"';
...
IF CONFIRM(STRSUBSTNO(ImportAttachmentQst, Caption),TRUE) THEN BEGIN
```
Bad code
```al
...
IF NOT
CONFIRM(
STRSUBSTNO(
'Difference on Periodic entries: %1 on %2' +
'Do you want to continue?',Balance,Date),
TRUE)
THEN
ERROR('Program terminated by the user');
```
Good code
```al
DiffOnPeriodEntiesQst@100 : TextConst 'ENU="Difference on Periodic entries: %1 on %2\\ Do you want to continue?"';
ProgramTerminatedErr@200 : TextConst 'ENU="Program terminated by the user"';
...
IF NOT CONFIRM(STRSUBSTNO(DiffOnPeriodEntiesQst,Balance,Date),TRUE) THEN
ERROR(ProgramTerminatedErr);
```

View file

@ -0,0 +1,23 @@
+++
title = "Using OptionCaptionML"
weight = 1380
+++
The OptionCaptionML should be filled in for sourceexpression using option data types.
Bad code
{ 30 ;TextBox ;17850;0 ;150 ;423 ;Name=Selection;
SourceExpr=Selection;
DataSetFieldName=Selection }
...
Selection@1008 : 'Open,Closed,Open and Closed';
...
Good code
{ 30 ;TextBox ;17850;0 ;150 ;423 ;Name=Selection;
OptionCaptionML=ENU=Open,Closed,Open and Closed;
SourceExpr=Selection;
DataSetFieldName=Selection }
...
Selection@1008 : 'Open,Closed,Open and Closed';