From 94f4a2b5b731ca1a47dc1fc9d21e38e348c52ed6 Mon Sep 17 00:00:00 2001 From: Andreas Moth Date: Fri, 14 Feb 2025 11:09:17 +0100 Subject: [PATCH 1/2] Retention Policy: Convert total number of deleted records to BigInteger --- .../ApplyRetentionPolicyImpl.Codeunit.al | 8 ++++---- .../Apply Retention Policy/RetenPolDeletingParam.Table.al | 8 ++++---- .../Retention Policy Setup/RetentionPolicySetup.Table.al | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/System Application/App/Retention Policy/src/Apply Retention Policy/ApplyRetentionPolicyImpl.Codeunit.al b/src/System Application/App/Retention Policy/src/Apply Retention Policy/ApplyRetentionPolicyImpl.Codeunit.al index 9f25194213..7bdd56355a 100644 --- a/src/System Application/App/Retention Policy/src/Apply Retention Policy/ApplyRetentionPolicyImpl.Codeunit.al +++ b/src/System Application/App/Retention Policy/src/Apply Retention Policy/ApplyRetentionPolicyImpl.Codeunit.al @@ -19,7 +19,7 @@ codeunit 3904 "Apply Retention Policy Impl." Permissions = tabledata AllObjWithCaption = r; var - TotalNumberOfRecordsDeleted: Integer; + TotalNumberOfRecordsDeleted: BigInteger; EndCurrentRun: Boolean; ApplyAllRetentionPolicies: Boolean; IsUserInvokedRun: Boolean; @@ -222,7 +222,7 @@ codeunit 3904 "Apply Retention Policy Impl." RecordRefDuplicate: RecordRef; RetenPolDeleting: Interface "Reten. Pol. Deleting"; Handled: Boolean; - NumberOfRecordsDeleted: Integer; + NumberOfRecordsDeleted: BigInteger; RecordCountBefore: Integer; RecordCountAfter: Integer; begin @@ -427,12 +427,12 @@ codeunit 3904 "Apply Retention Policy Impl." exit(RetentionPolicyLogCategory::"Retention Policy - Apply"); end; - internal procedure MaxNumberOfRecordsToDelete(): Integer + internal procedure MaxNumberOfRecordsToDelete(): BigInteger begin exit(10000) end; - internal procedure NumberOfRecordsToDeleteBuffer(): Integer + internal procedure NumberOfRecordsToDeleteBuffer(): BigInteger begin exit(0) end; diff --git a/src/System Application/App/Retention Policy/src/Apply Retention Policy/RetenPolDeletingParam.Table.al b/src/System Application/App/Retention Policy/src/Apply Retention Policy/RetenPolDeletingParam.Table.al index 1ff1b0f3aa..5e32fb6025 100644 --- a/src/System Application/App/Retention Policy/src/Apply Retention Policy/RetenPolDeletingParam.Table.al +++ b/src/System Application/App/Retention Policy/src/Apply Retention Policy/RetenPolDeletingParam.Table.al @@ -56,7 +56,7 @@ table 3907 "Reten. Pol. Deleting Param" /// /// Indicates the maximum number of records to be deleted. /// - field(4; "Max. Number of Rec. to Delete"; Integer) + field(4; "Max. Number of Rec. to Delete"; BigInteger) { DataClassification = SystemMetadata; MinValue = 0; @@ -69,9 +69,9 @@ table 3907 "Reten. Pol. Deleting Param" DataClassification = SystemMetadata; } /// - /// Indicates the maximum number of records that can be deleted at the same time accross all retention policies + /// Indicates the maximum number of records that can be deleted at the same time across all retention policies /// - field(6; "Total Max. Nr. of Rec. to Del."; Integer) + field(6; "Total Max. Nr. of Rec. to Del."; BigInteger) { DataClassification = SystemMetadata; MinValue = 0; @@ -88,7 +88,7 @@ table 3907 "Reten. Pol. Deleting Param" /// The number of records in the table before the deletion. /// The count is calculated once before passing this table to the deletion implementation and is used to limit the number of records to be deleted as well as record the number of records actually deleted. /// - field(8; "Record Count Before Delete"; Integer) + field(8; "Record Count Before Delete"; BigInteger) { DataClassification = SystemMetadata; } diff --git a/src/System Application/App/Retention Policy/src/Retention Policy Setup/RetentionPolicySetup.Table.al b/src/System Application/App/Retention Policy/src/Retention Policy Setup/RetentionPolicySetup.Table.al index 7015a2f4d7..496a68d488 100644 --- a/src/System Application/App/Retention Policy/src/Retention Policy Setup/RetentionPolicySetup.Table.al +++ b/src/System Application/App/Retention Policy/src/Retention Policy Setup/RetentionPolicySetup.Table.al @@ -148,7 +148,7 @@ table 3901 "Retention Policy Setup" { DataClassification = SystemMetadata; } - field(100; "Number Of Records Deleted"; Integer) + field(100; "Number Of Records Deleted"; BigInteger) { DataClassification = SystemMetadata; Access = Internal; From 6692936bb2e59b4f1eb279c05d46f95d39c50284 Mon Sep 17 00:00:00 2001 From: Andreas Moth Date: Mon, 17 Feb 2025 09:41:18 +0100 Subject: [PATCH 2/2] pragma ignore convertion of Integer to BigInteger as this is supported. --- .../Apply Retention Policy/RetenPolDeletingParam.Table.al | 6 ++++++ .../Retention Policy Setup/RetentionPolicySetup.Table.al | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/System Application/App/Retention Policy/src/Apply Retention Policy/RetenPolDeletingParam.Table.al b/src/System Application/App/Retention Policy/src/Apply Retention Policy/RetenPolDeletingParam.Table.al index 5e32fb6025..334162923a 100644 --- a/src/System Application/App/Retention Policy/src/Apply Retention Policy/RetenPolDeletingParam.Table.al +++ b/src/System Application/App/Retention Policy/src/Apply Retention Policy/RetenPolDeletingParam.Table.al @@ -56,11 +56,13 @@ table 3907 "Reten. Pol. Deleting Param" /// /// Indicates the maximum number of records to be deleted. /// +#pragma warning disable AS0004 field(4; "Max. Number of Rec. to Delete"; BigInteger) { DataClassification = SystemMetadata; MinValue = 0; } +#pragma warning restore AS0004 /// /// if set to true the event OnApplyRetentionPolicyRecordLimitExceeded will not be raised. /// @@ -71,11 +73,13 @@ table 3907 "Reten. Pol. Deleting Param" /// /// Indicates the maximum number of records that can be deleted at the same time across all retention policies /// +#pragma warning disable AS0004 field(6; "Total Max. Nr. of Rec. to Del."; BigInteger) { DataClassification = SystemMetadata; MinValue = 0; } +#pragma warning restore AS0004 /// /// If true, indicates that user is applying the retention policies manually. /// If false, the retention policies are applied by a scheduled task. @@ -88,10 +92,12 @@ table 3907 "Reten. Pol. Deleting Param" /// The number of records in the table before the deletion. /// The count is calculated once before passing this table to the deletion implementation and is used to limit the number of records to be deleted as well as record the number of records actually deleted. /// +#pragma warning disable AS0004 field(8; "Record Count Before Delete"; BigInteger) { DataClassification = SystemMetadata; } +#pragma warning restore AS0004 } keys diff --git a/src/System Application/App/Retention Policy/src/Retention Policy Setup/RetentionPolicySetup.Table.al b/src/System Application/App/Retention Policy/src/Retention Policy Setup/RetentionPolicySetup.Table.al index 496a68d488..116eb150d7 100644 --- a/src/System Application/App/Retention Policy/src/Retention Policy Setup/RetentionPolicySetup.Table.al +++ b/src/System Application/App/Retention Policy/src/Retention Policy Setup/RetentionPolicySetup.Table.al @@ -148,12 +148,14 @@ table 3901 "Retention Policy Setup" { DataClassification = SystemMetadata; } +#pragma warning disable AS0004 field(100; "Number Of Records Deleted"; BigInteger) { DataClassification = SystemMetadata; Access = Internal; Editable = false; } +#pragma warning restore AS0004 } keys