This commit is contained in:
TheDoubleH 2022-02-25 16:46:16 +00:00
parent a35732a260
commit a527835756
201 changed files with 598 additions and 1100 deletions

View file

@ -21,22 +21,22 @@ When you perform a “DeleteAll” when there is nothing to delete, it w
<meta property="og:title" content="DeleteAll">
<meta property="og:description" content="Created by waldo, Described by waldo
Description When you perform a &ldquo;DeleteAll&rdquo; 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&rsquo;s good practice to always check if the table is empty when performing a DeleteAll.
Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good code EmptyTableWLD.SetRange(Code,'AJ');ifnotEmptyTableWLD.IsEmpty() thenEmptyTableWLD.DeleteAll(true);Discussions You can discuss the guideline here">
Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good code EmptyTableWLD.SetRange(Code,'AJ');ifnotEmptyTableWLD.IsEmpty() thenEmptyTableWLD.">
<meta property="og:type" content="article">
<meta property="og:url" content="https://alguidelines.dev/docs/bestpractices/deleteall/"><meta property="og:image" content="https://alguidelines.dev/images/og-image-fission.png"><meta property="article:section" content="docs">
<meta property="article:modified_time" content="2022-02-24T14:45:35+01:00"><meta property="og:site_name" content="alguidelines.dev - Business Central Design Patterns">
<meta property="article:modified_time" content="2022-02-24T15:36:06-08:00"><meta property="og:site_name" content="alguidelines.dev - Business Central Design Patterns">
<meta itemprop=name content="DeleteAll">
<meta itemprop=description content="Created by waldo, Described by waldo
Description When you perform a &ldquo;DeleteAll&rdquo; 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&rsquo;s good practice to always check if the table is empty when performing a DeleteAll.
Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good code EmptyTableWLD.SetRange(Code,'AJ');ifnotEmptyTableWLD.IsEmpty() thenEmptyTableWLD.DeleteAll(true);Discussions You can discuss the guideline here">
<meta itemprop=dateModified content="2022-02-24T14:45:35+01:00">
<meta itemprop=wordCount content="103"><meta itemprop=image content="https://alguidelines.dev/images/og-image-fission.png">
Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good code EmptyTableWLD.SetRange(Code,'AJ');ifnotEmptyTableWLD.IsEmpty() thenEmptyTableWLD.">
<meta itemprop=dateModified content="2022-02-24T15:36:06-08:00">
<meta itemprop=wordCount content="64"><meta itemprop=image content="https://alguidelines.dev/images/og-image-fission.png">
<meta itemprop=keywords content="AL,Performance,"><meta name=twitter:card content="summary_large_image">
<meta name=twitter:image content="https://alguidelines.dev/images/og-image-fission.png">
<meta name=twitter:title content="DeleteAll">
<meta name=twitter:description content="Created by waldo, Described by waldo
Description When you perform a &ldquo;DeleteAll&rdquo; 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&rsquo;s good practice to always check if the table is empty when performing a DeleteAll.
Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good code EmptyTableWLD.SetRange(Code,'AJ');ifnotEmptyTableWLD.IsEmpty() thenEmptyTableWLD.DeleteAll(true);Discussions You can discuss the guideline here">
Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good code EmptyTableWLD.SetRange(Code,'AJ');ifnotEmptyTableWLD.IsEmpty() thenEmptyTableWLD.">
<link rel=preload href=/scss/main.min.84a617ff0c0265eb62b5cd2929c572f4ed37dc4907d0cf068be4eb2974f6d60f.css as=style>
<link href=/scss/main.min.84a617ff0c0265eb62b5cd2929c572f4ed37dc4907d0cf068be4eb2974f6d60f.css rel=stylesheet integrity>
<script src=https://code.jquery.com/jquery-3.6.0.min.js integrity=sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK crossorigin=anonymous></script>
@ -66,7 +66,7 @@ Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good co
</li>
</ul>
</div>
<div class="navbar-nav d-none d-lg-block"><input type=search class="form-control td-search-input" placeholder="&#xf002; Search this site…" aria-label="Search this site…" autocomplete=off data-offline-search-index-json-src=/offline-search-index.2b0c36478a8660f3dec37e0c539508bc.json data-offline-search-base-href=/ data-offline-search-max-results=10>
<div class="navbar-nav d-none d-lg-block"><input type=search class="form-control td-search-input" placeholder="&#xf002; Search this site…" aria-label="Search this site…" autocomplete=off data-offline-search-index-json-src=/offline-search-index.446cc05ee9bff165bd123d203082adb7.json data-offline-search-base-href=/ data-offline-search-max-results=10>
</div>
</nav>
</header>
@ -77,7 +77,7 @@ Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good co
<div id=td-sidebar-menu class=td-sidebar__inner>
<div id=content-mobile>
<form class="td-sidebar__search d-flex align-items-center">
<input type=search class="form-control td-search-input" placeholder="&#xf002; Search this site…" aria-label="Search this site…" autocomplete=off data-offline-search-index-json-src=/offline-search-index.2b0c36478a8660f3dec37e0c539508bc.json data-offline-search-base-href=/ data-offline-search-max-results=10>
<input type=search class="form-control td-search-input" placeholder="&#xf002; Search this site…" aria-label="Search this site…" autocomplete=off data-offline-search-index-json-src=/offline-search-index.446cc05ee9bff165bd123d203082adb7.json data-offline-search-base-href=/ data-offline-search-max-results=10>
<button class="btn btn-link td-sidebar__toggle d-md-none p-0 ml-3 fas fa-bars" type=button data-toggle=collapse data-target=#td-section-nav aria-controls=td-docs-nav aria-expanded=false aria-label="Toggle section navigation">
</button>
</form>
@ -503,14 +503,6 @@ Bad code EmptyTableWLD.SetRange(Code,'AJ');EmptyTableWLD.DeleteAll(true);Good co
<a href="https://github.com/microsoft/alguidelines/discussions?discussions_q=DeleteAll" class=td-page-meta--issue target=_blank rel=noopener><i class="fab fa-github fa-fw"></i> Discussions</a>
<a href=https://github.com/microsoft/alguidelines/issues/new class=td-page-meta--project-issue target=_blank rel=noopener><i class="fas fa-tasks fa-fw"></i> Create project issue</a>
</div>
<div class=td-toc><nav id=TableOfContents>
<ul>
<li><a href=#description>Description</a></li>
<li><a href=#bad-code>Bad code</a></li>
<li><a href=#good-code>Good code</a></li>
<li><a href=#discussions>Discussions</a></li>
</ul>
</nav></div>
<div class="taxonomy taxonomy-terms-cloud taxo-tags">
<h5 class=taxonomy-title>Tag Cloud</h5>
<ul class=taxonomy-terms>
@ -574,12 +566,9 @@ Therefore it&rsquo;s good practice to always check if the table is empty when pe
<div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-al data-lang=al><span style=color:#f8f8f8;text-decoration:underline> </span>EmptyTableWLD<span style=color:#ce5c00;font-weight:700>.</span>SetRange<span style=color:#ce5c00;font-weight:700>(</span><span style=color:#204a87;font-weight:700>Code</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#39;AJ&#39;</span><span style=color:#ce5c00;font-weight:700>)</span><span style=color:#000;font-weight:700>;</span><span style=color:#f8f8f8;text-decoration:underline>
</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>if</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>not</span><span style=color:#f8f8f8;text-decoration:underline> </span>EmptyTableWLD<span style=color:#ce5c00;font-weight:700>.</span>IsEmpty<span style=color:#ce5c00;font-weight:700>() </span><span style=color:#204a87;font-weight:700>then</span><span style=color:#f8f8f8;text-decoration:underline>
</span><span style=color:#f8f8f8;text-decoration:underline> </span>EmptyTableWLD<span style=color:#ce5c00;font-weight:700>.</span>DeleteAll<span style=color:#ce5c00;font-weight:700>(</span>true<span style=color:#ce5c00;font-weight:700>)</span><span style=color:#000;font-weight:700>;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></code></pre></div><h2 id=discussions>Discussions</h2>
<p>You can discuss the guideline <a href=https://github.com/microsoft/alguidelines/discussions/107>here</a></p>
<p>You can find discussions on all &ldquo;Best Practices&rdquo; <a href=https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices>here</a>.</p>
<p>If you don&rsquo;t find the discussion of this guideline, please feel free to create a new one with the same title as this article.</p>
</span></code></pre></div>
<div class="text-muted mt-5 pt-3 border-top">
Last modified February 24, 2022: <a href=https://github.com/microsoft/alguidelines/commit/5ee0436639455a35835c5ce88241d3fad662ee06>Added tags & categories + cleanup (5ee04366)</a>
Last modified February 24, 2022: <a href=https://github.com/microsoft/alguidelines/commit/fb17dc9640ceef53d1f3b8bbf9e9791ef92fabbc>Removed Discussion Links. Using new Theme solution. (fb17dc96)</a>
</div>
</div>
</main>