Fix formatting issues and syntax errors in code

This commit is contained in:
Frédéric Vercaemst 2023-11-24 15:16:38 +01:00
parent 8c58628b85
commit 3353c5184c
6 changed files with 32 additions and 32 deletions

View file

@ -17,7 +17,7 @@ Do not use blank lines:
### Bad code ### Bad code
```al ```al
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer); procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer)
begin begin
SetupDrillDownCol(MATRIX_ColumnOrdinal); SetupDrillDownCol(MATRIX_ColumnOrdinal);
@ -29,7 +29,7 @@ end;
### Good code ### Good code
```al ```al
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer); procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer)
begin begin
SetupDrillDownCol(MATRIX_ColumnOrdinal); SetupDrillDownCol(MATRIX_ColumnOrdinal);
DrillDown(false, ValueType); DrillDown(false, ValueType);

View file

@ -108,7 +108,7 @@ begin
end; end;
end; end;
procedure MigrateItemUnitOfMeasure(ItemDataMigrationFacade : Codeunit "Item Data Migration Facade"; ItemJson : Text); procedure MigrateItemUnitOfMeasure(ItemDataMigrationFacade : Codeunit "Item Data Migration Facade"; ItemJson : Text)
var var
MyUnitCodeStagingTable: Record "My Unit Code Staging Table"; MyUnitCodeStagingTable: Record "My Unit Code Staging Table";
DataMigrationStatusFacade: Codeunit "Data Migration Status Facade"; DataMigrationStatusFacade: Codeunit "Data Migration Status Facade";
@ -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: Below is a simplified example showing how to create an item:
```al ```al
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Data Migration Facade", 'OnMigrateItem', '', true, true)] [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 var
MyItemStagingTable : Record "My Item Staging Table"; MyItemStagingTable : Record "My Item Staging Table";
begin begin
@ -186,7 +186,7 @@ Below is another example showing how to use additional events to set fields that
```al ```al
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Data Migration Facade", 'OnMigrateItemUnitOfMeasure', '', true, true)] [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 var
MyItemStagingTable : Record "My Item Staging Table"; MyItemStagingTable : Record "My Item Staging Table";
MyUnitCodeStagingTable : Record "My Unit Code Staging Table"; MyUnitCodeStagingTable : Record "My Unit Code Staging Table";

View file

@ -26,7 +26,7 @@ First the command interface, it only has one procedure to execute the command
```al ```al
interface ICommand interface ICommand
{ {
procedure Execute(); procedure Execute()
} }
``` ```
@ -52,7 +52,7 @@ codeunit 50100 "Queue"
count += 1; count += 1;
end; end;
procedure Pop() value: Interface ICommand; procedure Pop() value: Interface ICommand
begin begin
if count > 0 then begin if count > 0 then begin
value := first.GetValue(); value := first.GetValue();
@ -78,22 +78,22 @@ codeunit 50100 "Queue"
codeunit 50102 "QueueEntry" codeunit 50102 "QueueEntry"
{ {
procedure SetValue(var v: Interface ICommand); procedure SetValue(var v: Interface ICommand)
begin begin
value := v; value := v;
end; end;
procedure GetValue(): Interface ICommand; procedure GetValue(): Interface ICommand
begin begin
exit(value); exit(value);
end; end;
procedure GetNextEntry(): Codeunit QueueEntry; procedure GetNextEntry(): Codeunit QueueEntry
begin begin
exit(NextEntry); exit(NextEntry);
end; end;
procedure SetNextEntry(var Entry: Codeunit QueueEntry); procedure SetNextEntry(var Entry: Codeunit QueueEntry)
begin begin
NextEntry := Entry; NextEntry := Entry;
end; end;
@ -136,7 +136,7 @@ codeunit 50104 "SalesOrderPostCommander" implements ICommand
codeunit 50103 "MessageCommander" implements ICommand codeunit 50103 "MessageCommander" implements ICommand
{ {
procedure SetText(value: Text); procedure SetText(value: Text)
begin begin
t := value; t := value;
end; end;
@ -185,7 +185,7 @@ codeunit 50105 PatchPostQueue
// Filter Sales Orders here // Filter Sales Orders here
end; end;
local procedure AddMessageToQueue(message : Text); local procedure AddMessageToQueue(message : Text)
var var
t: Codeunit MessageCommander; t: Codeunit MessageCommander;
object: Interface ICommand; object: Interface ICommand;
@ -195,7 +195,7 @@ codeunit 50105 PatchPostQueue
queue.Push(object); queue.Push(object);
end; end;
local procedure AddSalesOrderToQueue(No : Text); local procedure AddSalesOrderToQueue(No : Text)
var var
SaleOrderCommander: Codeunit SalesOrderPostCommander; SaleOrderCommander: Codeunit SalesOrderPostCommander;
object: Interface ICommand; object: Interface ICommand;

View file

@ -20,8 +20,8 @@ Like in this example, we have an interface, to implement different ways for gett
```AL ```AL
interface "IScale" interface "IScale"
{ {
procedure GetWeight(): Decimal; procedure GetWeight(): Decimal
procedure Tare(); procedure Tare()
} }
``` ```
@ -35,13 +35,13 @@ So, if we would implement it like this, it isn't really extensible, as a differe
```AL ```AL
codeunit 50407 "Scale Wrong" implements IScale codeunit 50407 "Scale Wrong" implements IScale
{ {
procedure GetWeight() Result: Decimal; procedure GetWeight() Result: Decimal
begin begin
//TODO: Implement Bar GetWeight //TODO: Implement Bar GetWeight
OnAfterGetWeight(Result); OnAfterGetWeight(Result);
end; end;
procedure Tare(); procedure Tare()
begin begin
//TODO: Implement Bar Tare //TODO: Implement Bar Tare
OnAfterTare(); OnAfterTare();
@ -86,13 +86,13 @@ codeunit 50405 "Scale Bar" implements IScale
var var
IScaleTriggers: Codeunit "IScale Triggers"; IScaleTriggers: Codeunit "IScale Triggers";
procedure GetWeight() Result: Decimal; procedure GetWeight() Result: Decimal
begin begin
//TODO: Implement Bar GetWeight //TODO: Implement Bar GetWeight
IScaleTriggers.OnAfterGetWeight(Result); IScaleTriggers.OnAfterGetWeight(Result);
end; end;
procedure Tare(); procedure Tare()
begin begin
//TODO: Implement Bar Tare //TODO: Implement Bar Tare
IScaleTriggers.OnAfterTare(); IScaleTriggers.OnAfterTare();

View file

@ -61,7 +61,7 @@ codeunit 53100 "WLD BlockCustomer Meth"
AcknowledgeBlockCustomer(HideDialog) AcknowledgeBlockCustomer(HideDialog)
end; end;
local procedure DoBlockCustomer(var Cust: Record Customer; IsHandled: Boolean); local procedure DoBlockCustomer(var Cust: Record Customer; IsHandled: Boolean)
begin begin
if IsHandled then if IsHandled then
exit; exit;
@ -93,12 +93,12 @@ codeunit 53100 "WLD BlockCustomer Meth"
end; end;
[IntegrationEvent(false, false)] [IntegrationEvent(false, false)]
local procedure OnBeforeBlockCustomer(var Cust: Record Customer; var IsHandled: Boolean); local procedure OnBeforeBlockCustomer(var Cust: Record Customer; var IsHandled: Boolean)
begin begin
end; end;
[IntegrationEvent(false, false)] [IntegrationEvent(false, false)]
local procedure OnAfterBlockCustomer(var Cust: Record Customer); local procedure OnAfterBlockCustomer(var Cust: Record Customer)
begin begin
end; end;
} }
@ -181,12 +181,12 @@ codeunit 53100 "WLD BlockCustomer Meth"
end; end;
... ...
[IntegrationEvent(false, false)] [IntegrationEvent(false, false)]
local procedure OnBeforeBlockCustomer(var Cust: Record Customer; var IsHandled: Boolean); local procedure OnBeforeBlockCustomer(var Cust: Record Customer; var IsHandled: Boolean)
begin begin
end; end;
[IntegrationEvent(false, false)] [IntegrationEvent(false, false)]
local procedure OnAfterBlockCustomer(var Cust: Record Customer); local procedure OnAfterBlockCustomer(var Cust: Record Customer)
begin begin
end; end;
} }
@ -200,7 +200,7 @@ The relevant part is:
```AL ```AL
codeunit 53100 "WLD BlockCustomer Meth" codeunit 53100 "WLD BlockCustomer Meth"
{ {
internal procedure BlockCustomer(var Cust: Record Customer; HideDialog: Boolean); internal procedure BlockCustomer(var Cust: Record Customer; HideDialog: Boolean)
var var
IsHandled: Boolean; IsHandled: Boolean;
begin begin
@ -209,7 +209,7 @@ codeunit 53100 "WLD BlockCustomer Meth"
... ...
end; end;
local procedure DoBlockCustomer(var Cust: Record Customer; IsHandled: Boolean); local procedure DoBlockCustomer(var Cust: Record Customer; IsHandled: Boolean)
begin begin
if IsHandled then if IsHandled then
exit; exit;

View file

@ -75,11 +75,11 @@ As the second part we need an interface for the export functions
```al ```al
interface IDataExport interface IDataExport
{ {
procedure CheckData(): Boolean; procedure CheckData(): Boolean
procedure GetLinesToExport(): Boolean; procedure GetLinesToExport(): Boolean
procedure ExportLine(); procedure ExportLine()
procedure NextLine(): Boolean; procedure NextLine(): Boolean
procedure Finish(); procedure Finish()
} }
``` ```