Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting issues and syntax errors in code #237

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/docs/BestPractices/blank-lines/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Do not use blank lines:
### Bad code

```al
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer);
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer)
begin

SetupDrillDownCol(MATRIX_ColumnOrdinal);
Expand All @@ -29,7 +29,7 @@ end;
### Good code

```al
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer);
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer)
begin
SetupDrillDownCol(MATRIX_ColumnOrdinal);
DrillDown(false, ValueType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ begin
end;
end;

procedure MigrateItemUnitOfMeasure(ItemDataMigrationFacade : Codeunit "Item Data Migration Facade"; ItemJson : Text);
procedure MigrateItemUnitOfMeasure(ItemDataMigrationFacade : Codeunit "Item Data Migration Facade"; ItemJson : Text)
var
MyUnitCodeStagingTable: Record "My Unit Code Staging Table";
DataMigrationStatusFacade: Codeunit "Data Migration Status Facade";
Expand Down Expand Up @@ -154,7 +154,7 @@ _Figure 3: Simplified sequence diagram of the data migration with staging tables
Below is a simplified example showing how to create an item:
```al
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Data Migration Facade", 'OnMigrateItem', '', true, true)]
procedure OnMigrateItem(VAR Sender : Codeunit "Item Data Migration Facade";RecordIdToMigrate : RecordId);
procedure OnMigrateItem(VAR Sender : Codeunit "Item Data Migration Facade";RecordIdToMigrate : RecordId)
var
MyItemStagingTable : Record "My Item Staging Table";
begin
Expand Down Expand Up @@ -186,7 +186,7 @@ Below is another example showing how to use additional events to set fields that

```al
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Data Migration Facade", 'OnMigrateItemUnitOfMeasure', '', true, true)]
procedure OnMigrateItemUnitOfMeasure(VAR Sender : Codeunit "Item Data Migration Facade";RecordIdToMigrate : RecordId);
procedure OnMigrateItemUnitOfMeasure(VAR Sender : Codeunit "Item Data Migration Facade";RecordIdToMigrate : RecordId)
var
MyItemStagingTable : Record "My Item Staging Table";
MyUnitCodeStagingTable : Record "My Unit Code Staging Table";
Expand Down
18 changes: 9 additions & 9 deletions content/docs/patterns/command-queue/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ First the command interface, it only has one procedure to execute the command
```al
interface ICommand
{
procedure Execute();
procedure Execute()
}
```

Expand All @@ -52,7 +52,7 @@ codeunit 50100 "Queue"
count += 1;
end;

procedure Pop() value: Interface ICommand;
procedure Pop() value: Interface ICommand
begin
if count > 0 then begin
value := first.GetValue();
Expand All @@ -78,22 +78,22 @@ codeunit 50100 "Queue"

codeunit 50102 "QueueEntry"
{
procedure SetValue(var v: Interface ICommand);
procedure SetValue(var v: Interface ICommand)
begin
value := v;
end;

procedure GetValue(): Interface ICommand;
procedure GetValue(): Interface ICommand
begin
exit(value);
end;

procedure GetNextEntry(): Codeunit QueueEntry;
procedure GetNextEntry(): Codeunit QueueEntry
begin
exit(NextEntry);
end;

procedure SetNextEntry(var Entry: Codeunit QueueEntry);
procedure SetNextEntry(var Entry: Codeunit QueueEntry)
begin
NextEntry := Entry;
end;
Expand Down Expand Up @@ -136,7 +136,7 @@ codeunit 50104 "SalesOrderPostCommander" implements ICommand

codeunit 50103 "MessageCommander" implements ICommand
{
procedure SetText(value: Text);
procedure SetText(value: Text)
begin
t := value;
end;
Expand Down Expand Up @@ -185,7 +185,7 @@ codeunit 50105 PatchPostQueue
// Filter Sales Orders here
end;

local procedure AddMessageToQueue(message : Text);
local procedure AddMessageToQueue(message : Text)
var
t: Codeunit MessageCommander;
object: Interface ICommand;
Expand All @@ -195,7 +195,7 @@ codeunit 50105 PatchPostQueue
queue.Push(object);
end;

local procedure AddSalesOrderToQueue(No : Text);
local procedure AddSalesOrderToQueue(No : Text)
var
SaleOrderCommander: Codeunit SalesOrderPostCommander;
object: Interface ICommand;
Expand Down
12 changes: 6 additions & 6 deletions content/docs/patterns/event-bridge-pattern/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Like in this example, we have an interface, to implement different ways for gett
```AL
interface "IScale"
{
procedure GetWeight(): Decimal;
procedure Tare();
procedure GetWeight(): Decimal
procedure Tare()
}
```

Expand All @@ -35,13 +35,13 @@ So, if we would implement it like this, it isn't really extensible, as a differe
```AL
codeunit 50407 "Scale Wrong" implements IScale
{
procedure GetWeight() Result: Decimal;
procedure GetWeight() Result: Decimal
begin
//TODO: Implement Bar GetWeight
OnAfterGetWeight(Result);
end;

procedure Tare();
procedure Tare()
begin
//TODO: Implement Bar Tare
OnAfterTare();
Expand Down Expand Up @@ -86,13 +86,13 @@ codeunit 50405 "Scale Bar" implements IScale
var
IScaleTriggers: Codeunit "IScale Triggers";

procedure GetWeight() Result: Decimal;
procedure GetWeight() Result: Decimal
begin
//TODO: Implement Bar GetWeight
IScaleTriggers.OnAfterGetWeight(Result);
end;

procedure Tare();
procedure Tare()
begin
//TODO: Implement Bar Tare
IScaleTriggers.OnAfterTare();
Expand Down
14 changes: 7 additions & 7 deletions content/docs/patterns/generic-method-pattern/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ codeunit 53100 "WLD BlockCustomer Meth"
AcknowledgeBlockCustomer(HideDialog)
end;

local procedure DoBlockCustomer(var Cust: Record Customer; IsHandled: Boolean);
local procedure DoBlockCustomer(var Cust: Record Customer; IsHandled: Boolean)
begin
if IsHandled then
exit;
Expand Down Expand Up @@ -93,12 +93,12 @@ codeunit 53100 "WLD BlockCustomer Meth"
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeBlockCustomer(var Cust: Record Customer; var IsHandled: Boolean);
local procedure OnBeforeBlockCustomer(var Cust: Record Customer; var IsHandled: Boolean)
begin
end;

[IntegrationEvent(false, false)]
local procedure OnAfterBlockCustomer(var Cust: Record Customer);
local procedure OnAfterBlockCustomer(var Cust: Record Customer)
begin
end;
}
Expand Down Expand Up @@ -181,12 +181,12 @@ codeunit 53100 "WLD BlockCustomer Meth"
end;
...
[IntegrationEvent(false, false)]
local procedure OnBeforeBlockCustomer(var Cust: Record Customer; var IsHandled: Boolean);
local procedure OnBeforeBlockCustomer(var Cust: Record Customer; var IsHandled: Boolean)
begin
end;

[IntegrationEvent(false, false)]
local procedure OnAfterBlockCustomer(var Cust: Record Customer);
local procedure OnAfterBlockCustomer(var Cust: Record Customer)
begin
end;
}
Expand All @@ -200,7 +200,7 @@ The relevant part is:
```AL
codeunit 53100 "WLD BlockCustomer Meth"
{
internal procedure BlockCustomer(var Cust: Record Customer; HideDialog: Boolean);
internal procedure BlockCustomer(var Cust: Record Customer; HideDialog: Boolean)
var
IsHandled: Boolean;
begin
Expand All @@ -209,7 +209,7 @@ codeunit 53100 "WLD BlockCustomer Meth"
...
end;

local procedure DoBlockCustomer(var Cust: Record Customer; IsHandled: Boolean);
local procedure DoBlockCustomer(var Cust: Record Customer; IsHandled: Boolean)
begin
if IsHandled then
exit;
Expand Down
10 changes: 5 additions & 5 deletions content/docs/patterns/template-method-pattern/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ As the second part we need an interface for the export functions
```al
interface IDataExport
{
procedure CheckData(): Boolean;
procedure GetLinesToExport(): Boolean;
procedure ExportLine();
procedure NextLine(): Boolean;
procedure Finish();
procedure CheckData(): Boolean
procedure GetLinesToExport(): Boolean
procedure ExportLine()
procedure NextLine(): Boolean
procedure Finish()
}
```

Expand Down
Loading