From 9ddd8342958e3ffafc70f262140d9fd258d196d0 Mon Sep 17 00:00:00 2001 From: waldo1001 Date: Thu, 10 Feb 2022 14:08:28 +0100 Subject: [PATCH 1/3] DeleteAll #107 --- .../Performance/DeleteAll/index.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 content/BCBestPractices/Performance/DeleteAll/index.md diff --git a/content/BCBestPractices/Performance/DeleteAll/index.md b/content/BCBestPractices/Performance/DeleteAll/index.md new file mode 100644 index 00000000..d6632906 --- /dev/null +++ b/content/BCBestPractices/Performance/DeleteAll/index.md @@ -0,0 +1,33 @@ ++++ +title = "DeleteAll" +weight = 1180 ++++ +This is a guideline, some parts are optional (if there's no content, remove the whole paragraph). + +<_Created by waldo, Described by waldo_\> + +## Description + +When you perform a "DeleteAll" when there is nothing to delete, it will still perform a lock. When you for example perform a DeleteAll on an empty table, it will result in a table lock. +Therefore it's good practice to always check if the table is empty when performing a DeleteAll. + +## Bad code + +```al + EmptyTableWLD.Setrange(Code, 'AJ'); + EmptyTableWLD.DeleteAll(true); +``` + +## Good code + +```al + EmptyTableWLD.Setrange(Code, 'AJ'); + if not EmptyTableWLD.IsEmpty() then + EmptyTableWLD.DeleteAll(true); +``` + +## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=DeleteAll+category%3A%22BC+Best+Practices%22) + +You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). + +If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file From 04b4569f6a64627f5ba24412a8d1532609e14bfa Mon Sep 17 00:00:00 2001 From: waldo1001 Date: Thu, 10 Feb 2022 16:23:52 +0100 Subject: [PATCH 2/3] cleanup --- content/BCBestPractices/Performance/DeleteAll/index.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/content/BCBestPractices/Performance/DeleteAll/index.md b/content/BCBestPractices/Performance/DeleteAll/index.md index d6632906..3646b4b1 100644 --- a/content/BCBestPractices/Performance/DeleteAll/index.md +++ b/content/BCBestPractices/Performance/DeleteAll/index.md @@ -2,7 +2,6 @@ title = "DeleteAll" weight = 1180 +++ -This is a guideline, some parts are optional (if there's no content, remove the whole paragraph). <_Created by waldo, Described by waldo_\> @@ -14,14 +13,14 @@ Therefore it's good practice to always check if the table is empty when performi ## Bad code ```al - EmptyTableWLD.Setrange(Code, 'AJ'); + EmptyTableWLD.SetRange(Code, 'AJ'); EmptyTableWLD.DeleteAll(true); ``` ## Good code ```al - EmptyTableWLD.Setrange(Code, 'AJ'); + EmptyTableWLD.SetRange(Code, 'AJ'); if not EmptyTableWLD.IsEmpty() then EmptyTableWLD.DeleteAll(true); ``` @@ -30,4 +29,4 @@ Therefore it's good practice to always check if the table is empty when performi You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). -If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file +If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. \ No newline at end of file From faeb978e15b74107a3050a521ce474b2322333c3 Mon Sep 17 00:00:00 2001 From: waldo1001 Date: Thu, 10 Feb 2022 23:55:30 +0100 Subject: [PATCH 3/3] changed discussions --- content/BCBestPractices/Performance/DeleteAll/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/BCBestPractices/Performance/DeleteAll/index.md b/content/BCBestPractices/Performance/DeleteAll/index.md index 3646b4b1..bf159354 100644 --- a/content/BCBestPractices/Performance/DeleteAll/index.md +++ b/content/BCBestPractices/Performance/DeleteAll/index.md @@ -25,7 +25,9 @@ Therefore it's good practice to always check if the table is empty when performi EmptyTableWLD.DeleteAll(true); ``` -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=DeleteAll+category%3A%22BC+Best+Practices%22) +## Discussions + +You can discuss the guideline [here](https://github.com/microsoft/alguidelines/discussions/107) You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).