This commit is contained in:
JeremyVyska 2021-12-05 21:23:42 +00:00
parent b46ee5b225
commit e9d640d50a
164 changed files with 12201 additions and 3918 deletions

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.89.4">
<meta name=description content>
<title>Error Message Processing :: AL Guidelines</title>
<link href=/css/nucleus.css?1638662727 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1638662727 rel=stylesheet>
<link href=/css/featherlight.min.css?1638662727 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1638662727 rel=stylesheet>
<link href=/css/auto-complete.css?1638662727 rel=stylesheet>
<link href=/css/theme.css?1638662727 rel=stylesheet>
<link href=/css/theme-blue.css?1638662727 rel=stylesheet>
<link href=/css/variant.css?1638662727 rel=stylesheet>
<link href=/css/print.css?1638662727 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1638662727></script>
<link href=/css/nucleus.css?1638739417 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1638739417 rel=stylesheet>
<link href=/css/featherlight.min.css?1638739417 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1638739417 rel=stylesheet>
<link href=/css/auto-complete.css?1638739417 rel=stylesheet>
<link href=/css/theme.css?1638739417 rel=stylesheet>
<link href=/css/theme-blue.css?1638739417 rel=stylesheet>
<link href=/css/variant.css?1638739417 rel=stylesheet>
<link href=/css/print.css?1638739417 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1638739417></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/1-patterns/error-message-processing/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1638662727></script>
<script src=/js/auto-complete.js?1638662727></script>
<script src=/js/search.js?1638662727></script>
<script src=/js/lunr.min.js?1638739417></script>
<script src=/js/auto-complete.js?1638739417></script>
<script src=/js/search.js?1638739417></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -57,7 +57,7 @@ ALGuidelines.Dev
<li data-nav-id=/navpatterns/1-patterns/creating-custom-charts/ title="Creating Custom Charts" class=dd-item><a href=/navpatterns/1-patterns/creating-custom-charts/>Creating Custom Charts</a></li>
<li data-nav-id=/navpatterns/1-patterns/cross-session-events/ title="Cross Session Events" class=dd-item><a href=/navpatterns/1-patterns/cross-session-events/>Cross Session Events</a></li>
<li data-nav-id=/navpatterns/1-patterns/currently-active-record/ title="Currently Active Record" class=dd-item><a href=/navpatterns/1-patterns/currently-active-record/>Currently Active Record</a></li>
<li data-nav-id=/navpatterns/1-patterns/data-migration-facade/ title="Data Migration Facade" class=dd-item><a href=/navpatterns/1-patterns/data-migration-facade/>Data Migration Facade</a></li>
<li data-nav-id=/navpatterns/1-patterns/data-migration-facade/ title="Data Migration Façade" class=dd-item><a href=/navpatterns/1-patterns/data-migration-facade/>Data Migration Façade</a></li>
<li data-nav-id=/navpatterns/1-patterns/discovery-event/ title="Discovery Event" class=dd-item><a href=/navpatterns/1-patterns/discovery-event/>Discovery Event</a></li>
<li data-nav-id=/navpatterns/1-patterns/document/ title=Document class=dd-item><a href=/navpatterns/1-patterns/document/>Document</a></li>
<li data-nav-id=/navpatterns/1-patterns/easy-update-of-setup-or-supplementary-information/ title="Easy Update Of Setup Or Supplementary Information" class=dd-item><a href=/navpatterns/1-patterns/easy-update-of-setup-or-supplementary-information/>Easy Update Of Setup Or Supplementary Information</a></li>
@ -85,12 +85,17 @@ ALGuidelines.Dev
<li data-nav-id=/navpatterns/1-patterns/product-name/ title="Product Name" class=dd-item><a href=/navpatterns/1-patterns/product-name/>Product Name</a></li>
<li data-nav-id=/navpatterns/1-patterns/queries/ title=Queries class=dd-item><a href=/navpatterns/1-patterns/queries/>Queries</a><ul>
<li data-nav-id=/navpatterns/1-patterns/queries/select-distinct-with-queries/ title="SELECT DISTINCT with Queries" class=dd-item><a href=/navpatterns/1-patterns/queries/select-distinct-with-queries/>SELECT DISTINCT with Queries</a></li>
<li data-nav-id=/navpatterns/1-patterns/queries/use-queries-to-detect-duplicate-records/ title="use Queries to Detect Duplicate Records" class=dd-item><a href=/navpatterns/1-patterns/queries/use-queries-to-detect-duplicate-records/>use Queries to Detect Duplicate Records</a></li>
<li data-nav-id=/navpatterns/1-patterns/queries/use-queries-to-detect-duplicate-records/ title="Use Queries to Detect Duplicate Records" class=dd-item><a href=/navpatterns/1-patterns/queries/use-queries-to-detect-duplicate-records/>Use Queries to Detect Duplicate Records</a></li>
<li data-nav-id=/navpatterns/1-patterns/queries/use-queries-to-replace-nested-loops/ title="Use Queries to Replace Nested Loops" class=dd-item><a href=/navpatterns/1-patterns/queries/use-queries-to-replace-nested-loops/>Use Queries to Replace Nested Loops</a></li></ul></li>
<li data-nav-id=/navpatterns/1-patterns/read-once-initialization-and-validation/ title="Read-once Initialization and Validation" class=dd-item><a href=/navpatterns/1-patterns/read-once-initialization-and-validation/>Read-once Initialization and Validation</a></li>
<li data-nav-id=/navpatterns/1-patterns/released-entity/ title="Released Entity" class=dd-item><a href=/navpatterns/1-patterns/released-entity/>Released Entity</a></li>
<li data-nav-id=/navpatterns/1-patterns/report-selection/ title="Report Selection" class=dd-item><a href=/navpatterns/1-patterns/report-selection/>Report Selection</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/ title=Security class=dd-item><a href=/navpatterns/1-patterns/security/>Security</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/ title=Security class=dd-item><a href=/navpatterns/1-patterns/security/>Security</a><ul>
<li data-nav-id=/navpatterns/1-patterns/security/1-sensitive-data-encapsulation/ title="Sensitive Data Encapsulation" class=dd-item><a href=/navpatterns/1-patterns/security/1-sensitive-data-encapsulation/>Sensitive Data Encapsulation</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/2-data-encryption/ title="Data Encryption" class=dd-item><a href=/navpatterns/1-patterns/security/2-data-encryption/>Data Encryption</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/3-single-point-of-access/ title="Single Point of Access" class=dd-item><a href=/navpatterns/1-patterns/security/3-single-point-of-access/>Single Point of Access</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/4-masked-text/ title="Masked Text" class=dd-item><a href=/navpatterns/1-patterns/security/4-masked-text/>Masked Text</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/5-ssl-in-nav/ title="SSL in NAV" class=dd-item><a href=/navpatterns/1-patterns/security/5-ssl-in-nav/>SSL in NAV</a></li></ul></li>
<li data-nav-id=/navpatterns/1-patterns/setup-specificity-fallback/ title="Setup Specificity Fallback" class=dd-item><a href=/navpatterns/1-patterns/setup-specificity-fallback/>Setup Specificity Fallback</a></li>
<li data-nav-id=/navpatterns/1-patterns/silent-file-upload-and-download/ title="Silent File Upload and Download" class=dd-item><a href=/navpatterns/1-patterns/silent-file-upload-and-download/>Silent File Upload and Download</a></li>
<li data-nav-id=/navpatterns/1-patterns/singleton/ title=Singleton class=dd-item><a href=/navpatterns/1-patterns/singleton/>Singleton</a><ul>
@ -107,8 +112,22 @@ ALGuidelines.Dev
<li data-nav-id=/navpatterns/2-anti-patterns/nav-upgrade/ title="Nav Upgrade" class=dd-item><a href=/navpatterns/2-anti-patterns/nav-upgrade/>Nav Upgrade</a></li>
<li data-nav-id=/navpatterns/2-anti-patterns/reusable-bugs/ title="Reusable Bugs" class=dd-item><a href=/navpatterns/2-anti-patterns/reusable-bugs/>Reusable Bugs</a></li></ul></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ title="3. CAL Coding Guidelines" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/>3. CAL Coding Guidelines</a><ul>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/ title=Design class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/>Design</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internally-used-dot-net-types/ title="Internally-used DotNet Types" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internally-used-dot-net-types/>Internally-used DotNet Types</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/ title=Design class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/>Design</a><ul>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/by-reference-parameters/ title="By Reference Parameters" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/by-reference-parameters/>By Reference Parameters</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/class-coupling/ title="Class Coupling" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/class-coupling/>Class Coupling</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/ title="Cyclomatic Complexity" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/>Cyclomatic Complexity</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/ title="Encapsulate Local Functionality" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/>Encapsulate Local Functionality</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/ title="FINDSET FINDFIRST FINDLAST" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/>FINDSET FINDFIRST FINDLAST</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/initialized-variables/ title="Initialized Variables" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/initialized-variables/>Initialized Variables</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/maintainability-index/ title="Maintainability Index" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/maintainability-index/>Maintainability Index</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/ title="Parameter Placeholders" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/>Parameter Placeholders</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/static-object-invocation/ title="Static Object Invocation" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/static-object-invocation/>Static Object Invocation</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/unreachable-code/ title="Unreachable Code" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/unreachable-code/>Unreachable Code</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/ title="Unused Initialized Variables" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/>Unused Initialized Variables</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/unused-variables/ title="Unused Variables" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/unused-variables/>Unused Variables</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/ title="Variable Capacity Mismatch" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/>Variable Capacity Mismatch</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/ title="WITH Scope Name Collision" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/>WITH Scope Name Collision</a></li></ul></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internally-used-dot-net-types/ title="Internally used DotNet Types" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internally-used-dot-net-types/>Internally used DotNet Types</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internationalization/ title=Internationalization class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internationalization/>Internationalization</a><ul>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internationalization/using-calcdate/ title="Using Calcdate" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internationalization/using-calcdate/>Using Calcdate</a></li></ul></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/ title=Localizability class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/>Localizability</a><ul>
@ -121,7 +140,7 @@ ALGuidelines.Dev
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/ title="Begin as an 'After Word'" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/>Begin as an 'After Word'</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/begin-end/ title="Begin-End - Compound Only" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/begin-end/>Begin-End - Compound Only</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/ title="Binary Operator to Start Line" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/>Binary Operator to Start Line</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/ title="Blank Lines.md" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/>Blank Lines.md</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/ title="Blank Lines" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/>Blank Lines</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/case-actions/ title="CASE Action" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/case-actions/>CASE Action</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/ title="Colon usage in CASE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/>Colon usage in CASE</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/ title="Comments inside Curly Brackets" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/>Comments inside Curly Brackets</a></li>
@ -229,8 +248,10 @@ ALGuidelines.Dev
<p>Missing, invalid or incomplete data is a common issue during data processing in NAV. This article describes how to collect all error messages during processing using the error message component and present them to the user in a unified way, which enables the user to correct the errors efficiently. By leveraging the integrated error message logging functions, you can log a message with a single line of code and present it to the user with another one-liner.</p>
<h2 id=description>Description</h2>
<p>This article describes how to use the Error Message component in NAV, which in short gives you the possibility to:</p>
<p>1. Link an error message to the page which enables you to resolve the problem.<br>
2. Assemble all error messages in one central view instead of having to encounter them one by one.</p>
<ol>
<li>Link an error message to the page which enables you to resolve the problem.</li>
<li>Assemble all error messages in one central view instead of having to encounter them one by one.</li>
</ol>
<p>Validating data is a common task during data processing in NAV. Unfortunately, validation is often done using NAV&rsquo;s integrated ERROR and TESTFIELD functions, which halt execution of the process. The user will then have to locate the invalid / missing data, correct it and reinitiate the process, possibly running into the next error, making the cycle repeat itself. This can be a very tedious, time-consuming and frustrating process. The error message component aims at improving this experience by providing a lightweight framework for error message logging and this article will explain how to leverage this functionality in your code. By doing so, all error messages are gathered during (pre-)processing and are finally presented to the user. The user then has the possibility to click on the error message, which will open the record where the invalid / missing data is located, thereby enabling the user to correct all mistakes efficiently, from one central place and in one go.</p>
<p>The example below comes from a Mexican localization, where the user has to export financial balances and transactions into an XML file for government audit purposes. In order to generate valid files, some mandatory data needs to be entered in the system. By leveraging the error message component, the user will be presented with the following page, if missing or invalid data was discovered:</p>
<p><a href=image001.png><img src=image001.png alt=" "></a></p>
@ -239,13 +260,13 @@ ALGuidelines.Dev
<h2 id=usage>Usage</h2>
<p>In the processing function, define a temporary record of type &ldquo;Error Message&rdquo;. Use the functions on that record to populate the record with error message, a few of them being:</p>
<ul>
<li><strong>LogIfEmpty</strong>****</li>
<li><strong>LogIfLengthExceeded</strong>****</li>
<li><strong>LogIfInvalidCharacters</strong>****</li>
<li><strong>LogIfOutsideRange</strong>****</li>
<li><strong>LogIfGreaterThan</strong>****</li>
<li><strong>LogIfEqualTo</strong>****</li>
<li><strong>LogMessage</strong>****</li>
<li><strong>LogIfEmpty</strong></li>
<li><strong>LogIfLengthExceeded</strong></li>
<li><strong>LogIfInvalidCharacters</strong></li>
<li><strong>LogIfOutsideRange</strong></li>
<li><strong>LogIfGreaterThan</strong></li>
<li><strong>LogIfEqualTo</strong></li>
<li><strong>LogMessage</strong></li>
</ul>
<p>The following parameters must be provided to these functions:</p>
<ul>
@ -257,40 +278,39 @@ ALGuidelines.Dev
<p>When the processing is complete, you can check if any error messages of type &ldquo;Error&rdquo; were logged by calling the <strong>HasErrors</strong> function and you can show the list or error messages by calling the <strong>ShowErrorMessages</strong> function. You can also integrate the error messages list as a FactBox, but that is not part of this example.</p>
<h2 id=nav-specific-example>NAV Specific Example</h2>
<p>The code below is an example of how the error message component was used in one part of the before mentioned Mexican feature. This code iterates over all G/L Accounts and pipes information out into an XML file. While doing so, it is validated that all mandatory fields have values and meet certain conditions. And only if that is the case, is the XML document actually exported. Also notice, that an error message is logged, in case no G/L Accounts are found given the provided filters. That way, the user can be guided to setup the system correctly.</p>
<pre><code>PROCEDURE ExportChartOfAccounts@1(Year@1000 : Integer;Month@1001 : Integer);
VAR
**TempErrorMessage@1003 : TEMPORARY Record 700;
**BEGIN
**TempErrorMessage.ClearLog;** // only necessary if variable is global
...
CreateXMLHeader(Document,RootNode,CatalogoNodeTxt,Namespace,Year,Month,'1.1');
IF GLAccount.FINDSET THEN BEGIN
REPEAT
**TempErrorMessage.LogIfEmpty (GLAccount,GLAccount.FIELDNO(Name),TempErrorMessage.&quot;Message Type&quot;::Error);
</code></pre>
<p>**
XMLDOMManagement.AddElement(RootNode,&lsquo;Ctas&rsquo;,'',Namespace,Node);
XMLDOMManagement.AddAttribute(Node,&lsquo;CodAgrup&rsquo;,GLAccount.&ldquo;SAT Account Code&rdquo;);
&mldr;
CASE GLAccount.&ldquo;Debit/Credit&rdquo; OF
GLAccount.&ldquo;Debit/Credit&rdquo;::Debit:
XMLDOMManagement.AddAttribute(Node,&lsquo;Natur&rsquo;,&lsquo;D&rsquo;);
GLAccount.&ldquo;Debit/Credit&rdquo;::Credit:
XMLDOMManagement.AddAttribute(Node,&lsquo;Natur&rsquo;,&lsquo;A&rsquo;);
ELSE
**TempErrorMessage.LogMessage(
GLAccount,GLAccount.FIELDNO(&ldquo;Debit/Credit&rdquo;),TempErrorMessage.&ldquo;Message Type&rdquo;::Error,
STRSUBSTNO(GLAccountTypeErr,GLAccount.&ldquo;Debit/Credit&rdquo;,GLAccount.RECORDID));
** END;
UNTIL GLAccount.NEXT = 0;
END ELSE
**TempErrorMessage.LogSimpleMessage(TempErrorMessage.&ldquo;Message Type&rdquo;::Error,NoSATAccountDefinedErr);
**
**IF NOT TempErrorMessage.HasErrors(TRUE) THEN
** SaveXMLToClient(Document,Year,Month,&lsquo;CT&rsquo;);
**TempErrorMessage.ShowErrorMessages(FALSE);
**END;</p>
<p>One could also do pre-processing in a function of its own, and only if the pre-processing results in no error messages of type &ldquo;Error&rdquo; would the processing continue.</p>
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-AL data-lang=AL> <span style=color:#66d9ef>PROCEDURE</span> ExportChartOfAccounts@<span style=color:#ae81ff>1</span><span style=color:#f92672>(</span>Year@<span style=color:#ae81ff>1000</span> : <span style=color:#66d9ef>Integer</span>;Month@<span style=color:#ae81ff>1001</span> : <span style=color:#66d9ef>Integer</span><span style=color:#f92672>)</span>;
<span style=color:#66d9ef>VAR</span>
TempErrorMessage@<span style=color:#ae81ff>1003</span> : <span style=color:#66d9ef>TEMPORARY</span> <span style=color:#66d9ef>Record</span> <span style=color:#ae81ff>700</span>;
<span style=color:#66d9ef>BEGIN</span>
TempErrorMessage<span style=color:#f92672>.</span>ClearLog; <span style=color:#75715e>// only necessary if variable is global
</span><span style=color:#75715e></span> <span style=color:#f92672>...
</span><span style=color:#f92672> </span>CreateXMLHeader<span style=color:#f92672>(</span>Document,RootNode,CatalogoNodeTxt,Namespace,Year,Month,<span style=color:#e6db74>&#39;1.1&#39;</span><span style=color:#f92672>)</span>;
<span style=color:#66d9ef>IF</span> GLAccount<span style=color:#f92672>.</span>FINDSET <span style=color:#66d9ef>THEN</span> <span style=color:#66d9ef>BEGIN</span>
<span style=color:#66d9ef>REPEAT</span>
TempErrorMessage<span style=color:#f92672>.</span>LogIfEmpty <span style=color:#f92672>(</span>GLAccount,GLAccount<span style=color:#f92672>.</span>FIELDNO<span style=color:#f92672>(</span>Name<span style=color:#f92672>)</span>,TempErrorMessage<span style=color:#f92672>.</span>&#34;Message Type&#34;::Error<span style=color:#f92672>)</span>;
XMLDOMManagement<span style=color:#f92672>.</span>AddElement<span style=color:#f92672>(</span>RootNode,<span style=color:#e6db74>&#39;Ctas&#39;</span>,<span style=color:#e6db74>&#39;&#39;</span>,Namespace,Node<span style=color:#f92672>)</span>;
XMLDOMManagement<span style=color:#f92672>.</span>AddAttribute<span style=color:#f92672>(</span>Node,<span style=color:#e6db74>&#39;CodAgrup&#39;</span>,GLAccount<span style=color:#f92672>.</span>&#34;SAT Account Code&#34;<span style=color:#f92672>)</span>;
<span style=color:#f92672>...
</span><span style=color:#f92672> </span><span style=color:#66d9ef>CASE</span> GLAccount<span style=color:#f92672>.</span>&#34;Debit/Credit&#34; <span style=color:#66d9ef>OF</span>
GLAccount<span style=color:#f92672>.</span>&#34;Debit/Credit&#34;::Debit:
XMLDOMManagement<span style=color:#f92672>.</span>AddAttribute<span style=color:#f92672>(</span>Node,<span style=color:#e6db74>&#39;Natur&#39;</span>,<span style=color:#e6db74>&#39;D&#39;</span><span style=color:#f92672>)</span>;
GLAccount<span style=color:#f92672>.</span>&#34;Debit/Credit&#34;::Credit:
XMLDOMManagement<span style=color:#f92672>.</span>AddAttribute<span style=color:#f92672>(</span>Node,<span style=color:#e6db74>&#39;Natur&#39;</span>,<span style=color:#e6db74>&#39;A&#39;</span><span style=color:#f92672>)</span>;
<span style=color:#66d9ef>ELSE</span>
TempErrorMessage<span style=color:#f92672>.</span>LogMessage<span style=color:#f92672>(
</span><span style=color:#f92672> </span>GLAccount,GLAccount<span style=color:#f92672>.</span>FIELDNO<span style=color:#f92672>(</span>&#34;Debit/Credit&#34;<span style=color:#f92672>)</span>,TempErrorMessage<span style=color:#f92672>.</span>&#34;Message Type&#34;::Error,
STRSUBSTNO<span style=color:#f92672>(</span>GLAccountTypeErr,GLAccount<span style=color:#f92672>.</span>&#34;Debit/Credit&#34;,GLAccount<span style=color:#f92672>.</span><span style=color:#66d9ef>RECORDID</span><span style=color:#f92672>))</span>;
<span style=color:#66d9ef>END</span>;
<span style=color:#66d9ef>UNTIL</span> GLAccount<span style=color:#f92672>.</span>NEXT = <span style=color:#ae81ff>0</span>;
<span style=color:#66d9ef>END</span> <span style=color:#66d9ef>ELSE</span>
TempErrorMessage<span style=color:#f92672>.</span>LogSimpleMessage<span style=color:#f92672>(</span>TempErrorMessage<span style=color:#f92672>.</span>&#34;Message Type&#34;::Error,NoSATAccountDefinedErr<span style=color:#f92672>)</span>;
<span style=color:#66d9ef>IF</span> <span style=color:#f92672>NOT</span> TempErrorMessage<span style=color:#f92672>.</span>HasErrors<span style=color:#f92672>(</span>TRUE<span style=color:#f92672>) </span><span style=color:#66d9ef>THEN</span>
SaveXMLToClient<span style=color:#f92672>(</span>Document,Year,Month,<span style=color:#e6db74>&#39;CT&#39;</span><span style=color:#f92672>)</span>;
TempErrorMessage<span style=color:#f92672>.</span>ShowErrorMessages<span style=color:#f92672>(</span>FALSE<span style=color:#f92672>)</span>;
<span style=color:#66d9ef>END</span>;
</code></pre></div><p>One could also do pre-processing in a function of its own, and only if the pre-processing results in no error messages of type &ldquo;Error&rdquo; would the processing continue.</p>
<h2 id=ideas-for-improvement>Ideas for improvement</h2>
<p>By using this easy to use component, we have the possibility to extend this functionality going forward. A nice addition to the error message component would be the possibility to log the error messages persistently in a grouped manner, thereby allowing 3rd parties to see the issues the users bump into the most, or allowing 3rd parties to get an detailed insight into what happened, thereby enabling them to provide better support.</p>
<footer class=footline>
@ -305,12 +325,12 @@ END ELSE
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1638662727></script>
<script src=/js/perfect-scrollbar.min.js?1638662727></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1638662727></script>
<script src=/js/jquery.svg.pan.zoom.js?1638662727></script>
<script src=/js/featherlight.min.js?1638662727></script>
<script src=/js/modernizr.custom-3.6.0.js?1638662727></script>
<script src=/js/relearn.js?1638662727></script>
<script src=/js/clipboard.min.js?1638739417></script>
<script src=/js/perfect-scrollbar.min.js?1638739417></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1638739417></script>
<script src=/js/jquery.svg.pan.zoom.js?1638739417></script>
<script src=/js/featherlight.min.js?1638739417></script>
<script src=/js/modernizr.custom-3.6.0.js?1638739417></script>
<script src=/js/relearn.js?1638739417></script>
</body>
</html>