<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kodeqa</title>
	<atom:link href="https://kodeqa.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://kodeqa.com</link>
	<description>Official Website</description>
	<lastBuildDate>Thu, 10 Jul 2025 08:45:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://kodeqa.com/wp-content/uploads/2024/03/cropped-kodeqa-favicon-32x32.png</url>
	<title>Kodeqa</title>
	<link>https://kodeqa.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to combine multiple data sources into one in electronic reporting (ER) configurations</title>
		<link>https://kodeqa.com/how-to-combine-multiple-data-sources-into-one-in-electronic-reporting-er-configurations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-combine-multiple-data-sources-into-one-in-electronic-reporting-er-configurations</link>
		
		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Sat, 18 Jan 2025 08:42:50 +0000</pubDate>
				<category><![CDATA[Electronic Reporting]]></category>
		<category><![CDATA[CBD]]></category>
		<category><![CDATA[combine data sources]]></category>
		<category><![CDATA[combine lists]]></category>
		<category><![CDATA[D365FO]]></category>
		<category><![CDATA[electronic reporting]]></category>
		<category><![CDATA[ER configurations]]></category>
		<category><![CDATA[LISTJOIN]]></category>
		<guid isPermaLink="false">https://kodeqa.com/?p=1931</guid>

					<description><![CDATA[<p>When working with Electronic Reporting (ER) configurations, grouping records is often essential. The LISTJOIN function enables you to consolidate data from multiple lists, which is especially useful when managing data from various sources with common fields. Here’s how to make the most of the LISTJOIN function in your ER configurations. Using LISTJOIN in Electronic reporting [&#8230;]</p>
<p>The post <a href="https://kodeqa.com/how-to-combine-multiple-data-sources-into-one-in-electronic-reporting-er-configurations/">How to combine multiple data sources into one in electronic reporting (ER) configurations</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-large"><img fetchpriority="high" decoding="async" width="1024" height="690" src="https://kodeqa.com/wp-content/uploads/2025/01/2958290_v2-1024x690.jpg" alt="" class="wp-image-1970" srcset="https://kodeqa.com/wp-content/uploads/2025/01/2958290_v2-1024x690.jpg 1024w, https://kodeqa.com/wp-content/uploads/2025/01/2958290_v2-300x202.jpg 300w, https://kodeqa.com/wp-content/uploads/2025/01/2958290_v2-768x518.jpg 768w, https://kodeqa.com/wp-content/uploads/2025/01/2958290_v2-1536x1035.jpg 1536w, https://kodeqa.com/wp-content/uploads/2025/01/2958290_v2.jpg 2000w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>


<p>When working with Electronic Reporting (ER) configurations, grouping records is often essential. The <strong>LISTJOIN </strong>function enables you to consolidate data from multiple lists, which is especially useful when managing data from various sources with common fields. Here’s how to make the most of the <strong>LISTJOIN </strong>function in your ER configurations.</p>



</br>
<h2 class="wp-block-heading">Using LISTJOIN in Electronic reporting</h2>



<p>When displaying a repeating section in a template, you typically work with a single list (e.g., showing all lines of a sales invoice on a document). However, sometimes you need to combine records from multiple lists. This is helpful when data is spread across different sources that share common fields, like transactions in a project invoice. In this scenario, a project invoice might include multiple types of transactions, such as expenses, fees, items, and hourly charges.</p>



<p>Different lists may contain distinct fields, as seen in the example below.</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="203" height="348" src="https://kodeqa.com/wp-content/uploads/2024/11/Screenshot-2024-11-26-103142.png" alt="" class="wp-image-1935" style="width:174px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/11/Screenshot-2024-11-26-103142.png 203w, https://kodeqa.com/wp-content/uploads/2024/11/Screenshot-2024-11-26-103142-175x300.png 175w" sizes="(max-width: 203px) 100vw, 203px" /></figure>



</br>
<ul class="wp-block-list">
<li>The <strong>Expenses</strong> container has fields for <strong>Amount</strong>, <strong>Description</strong>, <strong>Quantity</strong>, and <strong>Type</strong>.</li>



<li>The <strong>Items</strong> container has fields for <strong>Amount</strong>, <strong>Description</strong>, <strong>ItemId</strong>, <strong>Quantity</strong>, and <strong>Unit</strong>.</li>
</ul>



<p>Below is the formula which allows us to join our two lists in our ER format’s mapping in a new calculated field:</p>



<pre class="wp-block-code"><code>LISTJOIN(@.Expenses, @.Items)</code></pre>



<p>The resulting list will only include the fields that are common across both lists, in this case, <strong>Amount</strong>, <strong>Description</strong>, and <strong>Quantity</strong>.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="195" height="124" src="https://kodeqa.com/wp-content/uploads/2024/11/Screenshot-2024-11-26-103758.png" alt="" class="wp-image-1936"/></figure>



<p></br></p>



<h2 class="wp-block-heading">Field Requirements</h2>



<p>To join records from different lists, ensure that any fields you want in the final, consolidated list exist in all the lists you’re combining. If a field is missing from even one of the lists, it won’t appear in the final joined list, potentially leaving gaps in your data.</p>



<p></br></p>



<h2 class="wp-block-heading">Handling Missing Fields</h2>



<p>If some lists lack the required fields, you can add those fields to make the list join work seamlessly. Ensure the new fields have the same name and type as in the other lists. You can set placeholders in your model mapping for these new fields to prevent errors from empty fields. </p>



<p></br></p>



<h2 class="wp-block-heading">Steps to Implement the Solution</h2>



<ol start="1" class="wp-block-list">
<li><strong>Identify Missing Fields</strong>: Determine which fields are missing in each list.</li>



<li><strong>Create Missing Fields</strong>: Add these fields with the same names and types to lists where they are missing. In our example, <strong>Expenses </strong>list is missing the <strong>ItemId </strong>and <strong>Unit </strong>fields, while the <strong>Items </strong>list is missing the <strong>Type </strong>field.</li>



<li><strong>Set Placeholders</strong>: Use placeholders in your model mapping for these fields to handle errors caused by empty fields.</li>
</ol>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="247" height="377" src="https://kodeqa.com/wp-content/uploads/2024/11/Screenshot-2024-11-26-110334.png" alt="" class="wp-image-1938" srcset="https://kodeqa.com/wp-content/uploads/2024/11/Screenshot-2024-11-26-110334.png 247w, https://kodeqa.com/wp-content/uploads/2024/11/Screenshot-2024-11-26-110334-197x300.png 197w" sizes="(max-width: 247px) 100vw, 247px" /></figure>



</br>
<p>The result is a consolidated list with all the required fields from both lists.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="270" height="221" src="https://kodeqa.com/wp-content/uploads/2024/11/Screenshot-2024-11-26-110833.png" alt="" class="wp-image-1941" style="width:250px;height:auto"/></figure>



</br>
<p>By following these steps, you can use the <strong>LISTJOIN </strong>function in an ER configuration effectively. This approach ensures your data is easily combined in single data source and is easy to display.</p>



<p><a href="https://www.freepik.com/free-vector/transfer-files-concept-landing-page_5632211.htm#fromView=search&amp;page=2&amp;position=12&amp;uuid=84e3f239-4ac5-4001-b151-b0b7afd7703a&amp;new_detail=true&amp;query=download+files+multiple">Image by freepik</a></p>



<p></p><p>The post <a href="https://kodeqa.com/how-to-combine-multiple-data-sources-into-one-in-electronic-reporting-er-configurations/">How to combine multiple data sources into one in electronic reporting (ER) configurations</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to keep rows from a section on the same page in a CBD (ER) report Word template</title>
		<link>https://kodeqa.com/electronic-reporting-how-to-keep-rows-from-a-section-on-the-same-page-in-a-word-template/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=electronic-reporting-how-to-keep-rows-from-a-section-on-the-same-page-in-a-word-template</link>
		
		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Sat, 18 Jan 2025 07:53:18 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Electronic Reporting]]></category>
		<category><![CDATA[CBD]]></category>
		<category><![CDATA[electronic reporting]]></category>
		<category><![CDATA[keep lines on one page]]></category>
		<category><![CDATA[keep lines together]]></category>
		<category><![CDATA[table breaks]]></category>
		<category><![CDATA[table split]]></category>
		<category><![CDATA[word template]]></category>
		<guid isPermaLink="false">https://kodeqa.com/?p=1913</guid>

					<description><![CDATA[<p>In Microsoft Word, customizing the layout of complex document templates requires careful attention to detail, especially when it comes to ensuring a clean print. One of the most common challenges is controlling how specific sections are displayed across pages. For example, if a table is slightly too large to fit at the end of one [&#8230;]</p>
<p>The post <a href="https://kodeqa.com/electronic-reporting-how-to-keep-rows-from-a-section-on-the-same-page-in-a-word-template/">How to keep rows from a section on the same page in a CBD (ER) report Word template</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="1024" src="https://kodeqa.com/wp-content/uploads/2024/11/9583791-1024x1024.jpg" alt="" class="wp-image-1925" style="width:784px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/11/9583791-1024x1024.jpg 1024w, https://kodeqa.com/wp-content/uploads/2024/11/9583791-300x300.jpg 300w, https://kodeqa.com/wp-content/uploads/2024/11/9583791-150x150.jpg 150w, https://kodeqa.com/wp-content/uploads/2024/11/9583791-768x768.jpg 768w, https://kodeqa.com/wp-content/uploads/2024/11/9583791-1536x1536.jpg 1536w, https://kodeqa.com/wp-content/uploads/2024/11/9583791-500x500.jpg 500w, https://kodeqa.com/wp-content/uploads/2024/11/9583791.jpg 2000w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>


<p>In Microsoft Word, customizing the layout of complex document templates requires careful attention to detail, especially when it comes to ensuring a clean print. One of the most common challenges is controlling how specific sections are displayed across pages. For example, if a table is slightly too large to fit at the end of one page, Word may split it across two pages by default, which can interrupt the visual flow and readability of the document.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="396" src="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_01-1024x396.png" alt="" class="wp-image-1918" style="width:698px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_01-1024x396.png 1024w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_01-300x116.png 300w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_01-768x297.png 768w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_01.png 1430w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>


<p>In this post, we’ll explore practical techniques for keeping entire sections or tables together on a single page when printing. This guide will walk you through setting up Word’s pagination options to ensure your content displays exactly as intended. Let’s dive into how you can make sure your content maintains its structure from screen to print.</p>



<h2 class="wp-block-heading">Create and setup a Parent Content Control</h2>



<p>To start, set up a parent content control around the entire section you want to keep on a single page. This is essential to ensure that Word treats the section as a single block.</p>



<ol class="wp-block-list">
<li><strong>Select the Location for the Content Control</strong>: Place your cursor at the position in the document where the section begins. This will serve as the starting point for the content control.</li>



<li><strong>Insert the Parent Content Control</strong>:
<ul class="wp-block-list">
<li>Navigate to the <strong>Developer tab</strong> in the Word ribbon. (If the Developer tab is not visible, enable it by going to File &gt; Options &gt; Customize Ribbon and checking &#8220;Developer.&#8221;)</li>



<li>Under <strong>Controls</strong>, click on <strong>Rich Text Content Control</strong> or <strong>Plain Text Content Control</strong>, depending on your content needs.</li>
</ul>
</li>
</ol>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="215" height="126" src="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_02.png" alt="" class="wp-image-1919" style="width:132px;height:auto" /></figure>



<h2 class="wp-block-heading">Adjust Paragraph Settings for the Content Control</h2>



<p>Now that you’ve created the parent content control, adjust its paragraph settings to prevent page breaks within the section.</p>



<ol class="wp-block-list">
<li><strong>Open Paragraph Settings</strong>: With the content control selected, go to <strong>Home &gt; Paragraph &gt; Paragraph settings</strong>, or simply right-click on the control and select <strong>Paragraph</strong>.<br></li>



<li><strong>Enable &#8220;Keep Lines Together&#8221; and &#8220;Keep with Next&#8221;</strong>: Under the <strong>Line and Page Breaks</strong> tab, check both “Keep lines together” and “Keep with next.” These settings ensure that Word will move the entire section to the next page if there isn’t enough space on the current page.</li>
</ol>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="409" height="587" src="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_03.png" alt="" class="wp-image-1920" style="width:347px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_03.png 409w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_03-209x300.png 209w" sizes="(max-width: 409px) 100vw, 409px" /></figure></div>


<h2 class="wp-block-heading">Create Your Table</h2>



<p>Now that the content control is set up, you can create the table within it. While the content control is still selected, insert your table.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="772" height="246" src="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_04.png" alt="" class="wp-image-1921" style="width:662px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_04.png 772w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_04-300x96.png 300w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_04-768x245.png 768w" sizes="(max-width: 772px) 100vw, 772px" /></figure></div>


<p>This action nests the table within the content control.</p>



<h2 class="wp-block-heading">Apply Line and Page Break Settings to Table Rows</h2>



<p>Finally, apply the same settings to the rows within the table to keep them together.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="768" height="620" src="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_05.png" alt="" class="wp-image-1922" style="width:668px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_05.png 768w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_05-300x242.png 300w" sizes="(max-width: 768px) 100vw, 768px" /></figure></div>


<ol class="wp-block-list">
<li>Select all the rows within the table (or any additional elements in the content control).<br></li>



<li>Right-click the selection, go to <strong>Paragraph</strong> settings, and enable <strong>Keep lines together</strong> and <strong>Keep with next</strong> again under <strong>Line and Page Breaks</strong>.</li>
</ol>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="409" height="587" src="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_06.png" alt="" class="wp-image-1923" style="width:346px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_06.png 409w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_06-209x300.png 209w" sizes="(max-width: 409px) 100vw, 409px" /></figure></div>


<h2 class="wp-block-heading">Final Result</h2>



<p>With this setup, Word will automatically move the entire section to the next page if there’s not enough room for it on the current one. This approach preserves the integrity of the layout, ensuring that no table or section is split across pages unexpectedly.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="374" src="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_07-1024x374.png" alt="" class="wp-image-1924" style="width:769px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_07-1024x374.png 1024w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_07-300x110.png 300w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_07-768x281.png 768w, https://kodeqa.com/wp-content/uploads/2024/11/004_RowsTogether_07.png 1500w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>


<p><a href="https://www.freepik.com/free-vector/files-management-concept-illustration_65666123.htm#fromView=search&amp;page=1&amp;position=1&amp;uuid=eb97ea1e-03e6-46d2-87e7-70c992e0b377" target="_blank" rel="noopener" title="">Image by storyset on Freepik</a></p>



<p></p><p>The post <a href="https://kodeqa.com/electronic-reporting-how-to-keep-rows-from-a-section-on-the-same-page-in-a-word-template/">How to keep rows from a section on the same page in a CBD (ER) report Word template</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to use nested ranges in a CBD (ER) report</title>
		<link>https://kodeqa.com/electronic-reporting-cbd-reports-using-nested-lists-in-a-word-template/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=electronic-reporting-cbd-reports-using-nested-lists-in-a-word-template</link>
		
		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Thu, 05 Sep 2024 21:15:25 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Electronic Reporting]]></category>
		<guid isPermaLink="false">https://kodeqa.com/?p=1895</guid>

					<description><![CDATA[<p>When developing a CBD report in the ER framework, there are situations where data needs to be displayed within nested ranges. For instance, in a sales invoice report, invoice lines might have associated markup charges for each line. This blog post will guide you through setting up nested ranges in a Word template to handle [&#8230;]</p>
<p>The post <a href="https://kodeqa.com/electronic-reporting-cbd-reports-using-nested-lists-in-a-word-template/">How to use nested ranges in a CBD (ER) report</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>When developing a CBD report in the ER framework, there are situations where data needs to be displayed within nested ranges. For instance, in a sales invoice report, invoice lines might have associated markup charges for each line. This blog post will guide you through setting up nested ranges in a Word template to handle such scenarios effectively.</p>



<h2 class="wp-block-heading">Format Design for Nested Ranges</h2>



<p>To properly display invoice lines and their associated charges on a sales invoice, you need to structure the format as follows:</p>



<ol class="wp-block-list">
<li><strong>Create a Range for Invoice Lines</strong>: Start by defining a record range for the sales invoice lines in your format design.</li>



<li><strong>Create a Nested Range for Charges</strong>: Inside the range for invoice lines, add a second nested range to contain markup charges specific to each line.</li>
</ol>



<p>The resulting format structure should resemble the following:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="306" height="353" src="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_01.png" alt="" class="wp-image-1897" srcset="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_01.png 306w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_01-260x300.png 260w" sizes="(max-width: 306px) 100vw, 306px" /></figure></div>


<h2 class="wp-block-heading">Set Up the Word Template</h2>



<p>To implement the format structure in your Word template, create a basic table that organizes the data as follows:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1355" height="197" src="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_02-1.png" alt="" class="wp-image-2003" style="width:796px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_02-1.png 1355w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_02-1-300x44.png 300w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_02-1-1024x149.png 1024w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_02-1-768x112.png 768w" sizes="(max-width: 1355px) 100vw, 1355px" /></figure></div>


<h5 class="wp-block-heading">Step 1: Create the Table Structure</h5>



<ol class="wp-block-list">
<li>Add a row for column headers at the top.</li>



<li>Set the <strong>InvoiceLines_Values </strong>record range as a repeating content control spanning the second to the last row of the table.</li>
</ol>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1331" height="254" src="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_03-1.png" alt="" class="wp-image-2004" style="width:784px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_03-1.png 1331w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_03-1-300x57.png 300w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_03-1-1024x195.png 1024w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_03-1-768x147.png 768w" sizes="(max-width: 1331px) 100vw, 1331px" /></figure></div>


<h5 class="wp-block-heading">Step 2: Map Invoice Line Fields</h5>



<ol class="wp-block-list">
<li>Use the first row of the repeating section to display fields like <strong>Item ID</strong>, <strong>Description</strong>, <strong>Quantity</strong>, <strong>Unit</strong>, and <strong>Amount</strong>.</li>



<li>In the second row of the repeating section (third row of the table), set the record range for the charges using <strong>InvoiceLines_MarkupTrans </strong>.</li>
</ol>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1311" height="211" src="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_04-1.png" alt="" class="wp-image-2005" style="width:788px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_04-1.png 1311w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_04-1-300x48.png 300w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_04-1-1024x165.png 1024w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_04-1-768x124.png 768w" sizes="(max-width: 1311px) 100vw, 1311px" /></figure></div>


<h5 class="wp-block-heading">Step 3: Add a Placeholder Row</h5>



<ol class="wp-block-list">
<li>Include a placeholder row as the last row of the <strong>InvoiceLines_Values </strong>repeating section. This row prevents layout issues during printing caused by overlapping start/end tags of the parent and child repeating content controls.</li>



<li>To minimize unwanted spacing, select the placeholder row and set its font size to <strong>1 pt</strong>.</li>
</ol>



<p>The resulting table should look something like this:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1334" height="180" src="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_05-1.png" alt="" class="wp-image-2006" style="width:792px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_05-1.png 1334w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_05-1-300x40.png 300w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_05-1-1024x138.png 1024w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_05-1-768x104.png 768w" sizes="(max-width: 1334px) 100vw, 1334px" /></figure></div>


<h2 class="wp-block-heading">Handling Empty Charges Rows</h2>



<p>When some invoice lines have no charges while others have multiple charge lines, the default setup can create empty rows for lines without charges. For example:</p>



<ul class="wp-block-list">
<li><strong>Line 1</strong>: 2 charge lines.</li>



<li><strong>Line 2 and Line 3</strong>: No charges. This would then result in a table output where we have 2 empty rows on each invoice line. </li>
</ul>



<p>The example might look something like this:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="744" height="245" src="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_06.png" alt="" class="wp-image-1902" style="width:572px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_06.png 744w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_06-300x99.png 300w" sizes="(max-width: 744px) 100vw, 744px" /></figure></div>


<h4 class="wp-block-heading">Solution</h4>



<p>One solution that you might think of is to use the removed property on the <strong>InvoiceLines_MarkupTrans </strong>record list, however that will not work as you might imagine. Instead, it will only check if the first invoice line has any charges on it, and if it does not then the whole <strong>InvoiceLines_MarkupTrans</strong> content control will be removed and no charges will be shown for any other invoice line.</p>



<p>To minimize empty space and ensure proper formatting of charges rows in your Word template, follow these detailed steps to create a style and apply it to content controls.</p>



<h5 class="wp-block-heading">Step 1: Create a New Style</h5>



<ol class="wp-block-list">
<li><strong>Open the Styles Pane</strong>:
<ul class="wp-block-list">
<li>Go to the <strong>Home</strong> tab in Word.</li>



<li>Click the small arrow in the <strong>Styles</strong> section to open the Styles pane.</li>
</ul>
</li>



<li><strong>Create a New Style</strong>:
<ul class="wp-block-list">
<li>In the Styles pane, click on the <strong>New Style</strong> button (usually a small icon at the bottom of the pane).</li>



<li>In the <strong>Create New Style from Formatting</strong> dialog box:
<ul class="wp-block-list">
<li>Enter a name for your style, e.g., &#8220;ConditionalFormattingStyle.&#8221;</li>



<li>Set the font size to your preferred value (e.g., 10 pt or 11 pt).</li>



<li>Choose other formatting options as needed (e.g., bold, italic, or font color).</li>
</ul>
</li>



<li>Click <strong>OK</strong> to save the style.</li>
</ul>
</li>
</ol>



<h5 class="wp-block-heading">Step 2: Apply the Style to Content Controls</h5>



<ol class="wp-block-list">
<li><strong>Select the Content Control</strong>:
<ul class="wp-block-list">
<li>In your Word template, click on the content control you want to format (e.g., a field in the charges row).</li>
</ul>
</li>



<li><strong>Open Content Control Properties</strong>:
<ul class="wp-block-list">
<li>Right-click the selected content control and choose <strong>Properties</strong>.</li>
</ul>
</li>



<li><strong>Enable Conditional Display</strong>:
<ul class="wp-block-list">
<li>In the <strong>Content Control Properties</strong> dialog box, check the option <strong>Use a style to format text typed into the empty control</strong>.</li>
</ul>
</li>



<li><strong>Apply the Style</strong>:
<ul class="wp-block-list">
<li>Click on the newly created style (&#8220;ConditionalFormattingStyle&#8221;) to apply it.</li>
</ul>
</li>
</ol>



<ol class="wp-block-list">
<li></li>
</ol>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="514" height="712" src="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_07.png" alt="" class="wp-image-1903" style="width:375px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_07.png 514w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_07-217x300.png 217w" sizes="(max-width: 514px) 100vw, 514px" /></figure></div>


<h2 class="wp-block-heading">Final Output</h2>



<p>After these adjustments, your template will produce a clean and professional output:</p>



<ul class="wp-block-list">
<li>Invoice lines without charges will have minimal empty space.</li>



<li>Invoice lines with charges will display charges correctly.</li>
</ul>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="805" height="215" src="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_08.png" alt="" class="wp-image-1904" style="width:572px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_08.png 805w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_08-300x80.png 300w, https://kodeqa.com/wp-content/uploads/2024/09/003_NestedLists_08-768x205.png 768w" sizes="(max-width: 805px) 100vw, 805px" /></figure></div>


<p>By following these steps, you can effectively manage nested ranges in a CBD report, ensuring that your Word templates are both functional and visually appealing.</p><p>The post <a href="https://kodeqa.com/electronic-reporting-cbd-reports-using-nested-lists-in-a-word-template/">How to use nested ranges in a CBD (ER) report</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to create and execute custom electronic reporting (ER) CBD reports in X++ </title>
		<link>https://kodeqa.com/how-to-create-and-execute-custom-electronic-reporting-er-cbd-reports-in-x/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-create-and-execute-custom-electronic-reporting-er-cbd-reports-in-x</link>
		
		<dc:creator><![CDATA[Kodeqa]]></dc:creator>
		<pubDate>Wed, 03 Jul 2024 14:45:57 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Electronic Reporting]]></category>
		<category><![CDATA[CBD]]></category>
		<category><![CDATA[D365FO]]></category>
		<category><![CDATA[electronic reporting]]></category>
		<category><![CDATA[run custom ER report]]></category>
		<guid isPermaLink="false">https://kodeqa.com/?p=1827</guid>

					<description><![CDATA[<p>In Dynamics 365 Finance and Operations, the Electronic Reporting (ER) framework offers robust tools for creating Configurable Business Document (CBD) reports tailored to your specific needs. Continuing from our previous blog post describing How to add a custom electronic reporting (ER) CBD report to print management, we will now explore how to develop and execute [&#8230;]</p>
<p>The post <a href="https://kodeqa.com/how-to-create-and-execute-custom-electronic-reporting-er-cbd-reports-in-x/">How to create and execute custom electronic reporting (ER) CBD reports in X++ </a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="669" src="https://kodeqa.com/wp-content/uploads/2024/07/559-2-1024x669.jpg" alt="" class="wp-image-1864" style="width:844px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/07/559-2-1024x669.jpg 1024w, https://kodeqa.com/wp-content/uploads/2024/07/559-2-300x196.jpg 300w, https://kodeqa.com/wp-content/uploads/2024/07/559-2-768x502.jpg 768w, https://kodeqa.com/wp-content/uploads/2024/07/559-2-1536x1003.jpg 1536w, https://kodeqa.com/wp-content/uploads/2024/07/559-2.jpg 1822w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>


<p>In Dynamics 365 Finance and Operations, the Electronic Reporting (ER) framework offers robust tools for creating Configurable Business Document (CBD) reports tailored to your specific needs. Continuing from our previous blog post describing <a href="https://kodeqa.com/how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management/" target="_blank" rel="noopener" title="How to add a custom electronic reporting (ER) CBD report to print management">How to add a custom electronic reporting (ER) CBD report to print management</a>, we will now explore how to develop and execute these custom reports using ER. </p>



<p>We will cover the steps needed to create a dedicated data provider class, setting up parameters for report customization, and executing custom CBD reports through the UI.&nbsp;</p>



<p></p>



<h2 class="wp-block-heading">Creating our CBD configurations</h2>



<p>We are going to start off by creating our CBD configurations which consist of a model, a model mapping and a report format.&nbsp;</p>



<p>For our example, we will have a model configuration named <strong>Custom Document model</strong>, out of which we will derive two new configurations, a model mapping and a report format. &nbsp;</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="258" height="63" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_1.png" alt="" class="wp-image-1830" style="width:240px;height:auto"/></figure>



<p>In our model, we have created a root node with a few <strong>Record </strong>and <strong>Record list</strong> nodes which additionally themselves contain a couple of data fields.&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="386" height="322" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_2.png" alt="" class="wp-image-1831" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_2.png 386w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_2-300x250.png 300w" sizes="(max-width: 386px) 100vw, 386px" /></figure>



<p>After the creation of the model mapping configuration (which is based on a completed version of our model), we are still missing the mappings between our model and our data sources. We will get to that step later in this blog post.&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="616" height="298" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_3.png" alt="" class="wp-image-1832" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_3.png 616w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_3-300x145.png 300w" sizes="(max-width: 616px) 100vw, 616px" /></figure>



<p>As the last step of this section we will need to do the initial setup of our report format. Here we will need to create a root node which will link to our template attachment and its parameters.&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="495" height="338" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_4.png" alt="" class="wp-image-1833" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_4.png 495w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_4-300x205.png 300w" sizes="(max-width: 495px) 100vw, 495px" /></figure>



<p></p>



<h2 class="wp-block-heading">Create the data contract, controller and service classes&nbsp;</h2>



<p>To execute our custom CBD report in code, we will need to create a new data contract, a controller and a service class.&nbsp;We will start with our data contract which will extend the standard <strong>ERFormatMappingRunBaseContract</strong>.&nbsp;</p>



<pre class="wp-block-code"><code>&#91;DataContract] 
public class CustomDocumentERContract  extends ERFormatMappingRunBaseContract 
{ 
} </code></pre>



<p>Here we can add additional <strong>parm </strong>methods which can be used to pass information such as specific fields or whole datasets to our CBD model mapping. We can achieve this by using the following code sample:</p>



<pre class="wp-block-code"><code>SalesId salesId; 
&#91;DataMemberAttribute('SalesOrder')] 
public SalesId parmSalesId(SalesId _salesId = salesId) 
{ 
    salesId = _salesId; 
    return salesId; 
} </code></pre>



<p>Our next step would be to create the service class and for that purpose we will need to extend the <strong>SysOperationServiceBase </strong>class. Here we are defining a few variables which will later be used to initialize and run the report:&nbsp;</p>



<ul class="wp-block-list">
<li>ER Model Data Source name – set this as “model”&nbsp;</li>



<li>The default file name for when we are exporting the report&nbsp;</li>



<li>Parameter data source name – this will be the name of our contract object when we add it to the model mapping&nbsp;</li>
</ul>



<pre class="wp-block-code"><code>using Microsoft.Dynamics365.LocalizationFramework; 
class CustomDocumentERService  extends SysOperationServiceBase 
{ 
    public const str ERModelDataSourceName = 'model'; 
    public const str DefaultExportedFileName = 'Custom document printout'; 
    public const str ParametersDataSourceName = 'RuntimeParameters'; 
} </code></pre>



<p>The second part that we will need in our service class is a method which will return the <strong>RecId </strong>value for our custom CBD report format.</p>



<pre class="wp-block-code"><code>public static ERFormatMappingId getFormatMapping() 
{ 
    return (select ERFormatMappingTable where ERFormatMappingTable.Name == 'Custom Document format').RecId; 
}</code></pre>



<p>The above <strong>formatMappingId </strong>will be used in our main service class method to initialize the <strong>ERFormatMappingRun </strong>object to which we send the above created parameters and then use to run the report.&nbsp;</p>



<pre class="wp-block-code"><code>public void executeOperation(CustomDocumentERContract _contract) 
{ 
    ERFormatMappingId formatMappingId; 
    formatMappingId = CustomDocumentERService::getFormatMapping(); 
    if(formatMappingId) 
    { 
        try 
        { 
            ERIModelDefinitionParamsAction parameters = new ERModelDefinitionParamsUIActionComposite()             
.add(new ERModelDefinitionObjectParameterAction(ERModelDataSourceName, ParametersDataSourceName, _contract, true)); 
            ERIFormatMappingRun formatMappingRun = ERObjectsFactory::createFormatMappingRunByFormatMappingId(formatMappingId); 
            formatMappingRun.withParameter(parameters); 
            formatMappingRun.parmFileName(DefaultExportedFileName); 
            formatMappingRun.withFileDestination(_contract.getFileDestination()); 
            formatMappingRun.parmShowPromptDialog(true); 
            formatMappingRun.run(); 
        } 
        catch 
        { 
            error("@SYP4861341"); 
        } 
    } 
    else 
    { 
        info("@SYS300117"); 
    }     
} </code></pre>



<p>The last part we need to modify is the controller class which is used when the menu item is triggered. This class contains the main method in which we will call the <strong>executeOperation </strong>method from the service class.</p>



<pre class="wp-block-code"><code>class CustomDocumentERController extends ERFormatMappingRunBaseController 
{ 
    public static void main(Args _args) 
    { 
        CustomDocumentERController operation; 
        CustomDocumentERContract   contract; 
        operation = new CustomDocumentERController(classStr(CustomDocumentERService), methodStr(CustomDocumentERService, executeOperation), SysOperationExecutionMode::Synchronous); 
        contract = operation.getDataContractObject(); 
        operation.parmShowDialog(true); 
        operation.startOperation(); 
    } 
} </code></pre>



<p></p>



<h2 class="wp-block-heading">Create the menu item</h2>



<p>Next, we will need to create an output menu item and setup some properties.&nbsp;&nbsp;</p>



<ul class="wp-block-list">
<li><strong>Object Type</strong> should be set to <strong>Class&nbsp;&nbsp;</strong></li>



<li>In the <strong>Object </strong>property we will select our controller class (<strong>CustomDocumentERController</strong>)&nbsp;</li>
</ul>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="657" height="568" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_5.png" alt="" class="wp-image-1834" style="width:454px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_5.png 657w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_5-300x259.png 300w" sizes="(max-width: 657px) 100vw, 657px" /></figure>



<p></p>



<h2 class="wp-block-heading">Fill in the data contract&nbsp;</h2>



<p>Either from the controller or from the service class, we can use the <strong>parm </strong>methods we have created in our contract class to pass information to our report format/model mapping.&nbsp;</p>



<pre class="wp-block-code"><code>contract.parmSalesId(salesId); </code></pre>



<p></p>



<h2 class="wp-block-heading">Add the data contract to the model mapping&nbsp;</h2>



<p>After we have made all the necessary code setup in the controller, service, and contract classes, we will return to the model mapping configuration to finish up with the mapping of the data sources. We will add a new data source which will be of type <strong>Object</strong> and then set up several of its parameters.&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="538" height="392" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_6.png" alt="" class="wp-image-1835" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_6.png 538w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_6-300x219.png 300w" sizes="(max-width: 538px) 100vw, 538px" /></figure>



<p>It is important to note here that the <strong>Name</strong> parameter should be the same as the <strong>ParametersDataSourceName </strong>parameter in the service class. For the <strong>Class </strong>parameter we should select our previously created contract class.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="435" height="293" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_7-edited.png" alt="" class="wp-image-1837" style="width:506px;height:auto" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_7-edited.png 435w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_7-edited-300x202.png 300w" sizes="(max-width: 435px) 100vw, 435px" /></figure>



<p>After we&#8217;ve added the data source, all of the details that are passed in code will now be available for our use, such as specific fields or whole datasets that can be used for mapping to the fields in our model.&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="349" height="256" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_8.png" alt="" class="wp-image-1838" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_8.png 349w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_8-300x220.png 300w" sizes="(max-width: 349px) 100vw, 349px" /></figure>



<p></p>



<h2 class="wp-block-heading">Create and set up an ER destination&nbsp;</h2>



<p>To be able to print our report we will need to create and setup a new destination in the Electronic Reporting destinations form.&nbsp;&nbsp;</p>



<p>For our example, we&#8217;ll add a new file destination and we&#8217;ll then in the <strong>Reference</strong> parameter select our report format that we&#8217;ve created earlier.&nbsp;&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="602" height="239" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_9.png" alt="" class="wp-image-1839" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_9.png 602w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_9-300x119.png 300w" sizes="(max-width: 602px) 100vw, 602px" /></figure>



<p>After the file destination is created, we then need to select our template in the <strong>File component name </strong>parameter.&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="602" height="285" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_10.png" alt="" class="wp-image-1840" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_10.png 602w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_10-300x142.png 300w" sizes="(max-width: 602px) 100vw, 602px" /></figure>



<p>In the end we will need to select our destination in the <strong>Settings </strong>menu which will determine where the report will be printed to. For our example, we will select <strong>File</strong> as the destination.&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="399" height="284" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_11.png" alt="" class="wp-image-1841" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_11.png 399w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_11-300x214.png 300w" sizes="(max-width: 399px) 100vw, 399px" /></figure>



<p></p>



<h2 class="wp-block-heading">Extra step 1: Set a file name for our CBD report&nbsp;</h2>



<p>We have two ways of setting up the file name for our report. We can either do it through code by sending the file name as a string to the format mapping run object (see the following code example):&nbsp;</p>



<pre class="wp-block-code"><code>public const str DefaultExportedFileName = 'Custom document export name'; 
formatMappingRun.parmFileName(DefaultExportedFileName); </code></pre>



<p>Or, the other option would be to setup our file name in the <strong>File name</strong> field available under the <strong>Mapping</strong> section of our root node in the CBD report format configuration:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="381" height="93" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_12.png" alt="" class="wp-image-1842" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_12.png 381w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_12-300x73.png 300w" sizes="(max-width: 381px) 100vw, 381px" /></figure>



<p>Keep in mind that you can use the file name setup from the report format configuration only if you are not sending a file name through code, otherwise the code will overwrite whatever setup you have done here.&nbsp;</p>



<p></p>



<h2 class="wp-block-heading">Extra step 2: Execute the report with and without a dialog&nbsp;</h2>



<p>When executing the CBD report, a show dialog parameter can be specified on the controller:</p>



<pre class="wp-block-code"><code>operation.parmShowDialog(true);</code></pre>



<p>If this is specified as true, then the following form with open up when trying to print the report:&nbsp;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="394" height="212" src="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_13.png" alt="" class="wp-image-1843" srcset="https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_13.png 394w, https://kodeqa.com/wp-content/uploads/2024/07/002_Execute-custom-CBD-in-code_13-300x161.png 300w" sizes="(max-width: 394px) 100vw, 394px" /></figure>



<p>The dialog shown would then list the parameters from our contract class as UI fields in which we can select specific records or data to be used for executing the the report.&nbsp;</p>



<p></p>



<h2 class="wp-block-heading">Final notes</h2>



<p>By following the steps we&#8217;ve described in this blog post, you&#8217;ll be able to execute your custom developed CBD reports from any location in D365FO that can host menu items. This allows for a better user experience when using custom ER CBD reports as part of your daily routine and is a vast improvement on the default option of executing the reports only from the Electronic Reporting workspace.</p>



<p></p>



<p></p>



<p><a href="https://www.freepik.com/free-vector/business-man-leader-flying-fast-his-success_1311459.htm#fromView=search&amp;page=3&amp;position=25&amp;uuid=b0082a3c-ee34-4f3f-874c-31d639ccdbb3" target="_blank" rel="noopener" title="">Image by iconicbestiary on Freepik</a></p><p>The post <a href="https://kodeqa.com/how-to-create-and-execute-custom-electronic-reporting-er-cbd-reports-in-x/">How to create and execute custom electronic reporting (ER) CBD reports in X++ </a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to add a custom electronic reporting (ER) CBD report to print management</title>
		<link>https://kodeqa.com/how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management</link>
		
		<dc:creator><![CDATA[Kodeqa]]></dc:creator>
		<pubDate>Mon, 03 Jun 2024 20:05:47 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Electronic Reporting]]></category>
		<category><![CDATA[CBD]]></category>
		<category><![CDATA[D365FO]]></category>
		<category><![CDATA[electronic reporting]]></category>
		<category><![CDATA[print management]]></category>
		<guid isPermaLink="false">https://kodeqa.com/?p=1752</guid>

					<description><![CDATA[<p>In the standard D365FO print management form, we have a number of predefined document types which can be setup to print different reports, however it is not an uncommon requirement to create one or multiple custom electronic reporting CBD formats for a document which does not exist in print management. In this post we are [&#8230;]</p>
<p>The post <a href="https://kodeqa.com/how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management/">How to add a custom electronic reporting (ER) CBD report to print management</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></description>
										<content:encoded><![CDATA[<div data-elementor-type="wp-post" data-elementor-id="1752" class="elementor elementor-1752">
				<div class="elementor-element elementor-element-1f213231 e-con-full e-flex e-con e-parent" data-id="1f213231" data-element_type="container">
				<div class="elementor-element elementor-element-47609cdb elementor-widget elementor-widget-text-editor" data-id="47609cdb" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									
<img loading="lazy" decoding="async" width="748" height="689" class="wp-image-1785 aligncenter" style="width: 600px; height: auto;" src="https://kodeqa.com/wp-content/uploads/2024/06/001_Intro-1.jpg" alt="" srcset="https://kodeqa.com/wp-content/uploads/2024/06/001_Intro-1.jpg 748w, https://kodeqa.com/wp-content/uploads/2024/06/001_Intro-1-300x276.jpg 300w" sizes="(max-width: 748px) 100vw, 748px" />

<p>In the standard D365FO print management form, we have a number of predefined document types which can be setup to print different reports, however it is not an uncommon requirement to create one or multiple custom electronic reporting CBD formats for a document which does not exist in print management.</p>
<p>In this post we are going to see how we can add a new document type to print management that we can use to configure and run custom CBD formats.</p>
<h6> </h6>
<h2>Adding a new document type</h2>
<p>Firstly, we are going to start off by adding our document type to the print management form of an existing or a custom module.</p>
<p>The steps we need to take are as follows:</p>
<ol>
<li>We extend the <strong>PrintMgmtDocumentType</strong> enum:
<ul>
<li>Add a new element with a relevant name for your report.<br /><img loading="lazy" decoding="async" class="alignnone wp-image-1754" src="https://kodeqa.com/wp-content/uploads/2024/06/001_Screenshot-300x115.png" alt="PrintMgmtDocumentType" width="595" height="228" srcset="https://kodeqa.com/wp-content/uploads/2024/06/001_Screenshot-300x115.png 300w, https://kodeqa.com/wp-content/uploads/2024/06/001_Screenshot.png 551w" sizes="(max-width: 595px) 100vw, 595px" /></li>
<li>Create an extension of the <strong>PrintMgmtNode</strong> class specific to your module. If for example, we are working with a standard module, we are going to modify the <strong>WhsPrintMgmtNode_WHS</strong> class which applies to the Warehouse management module. Modify the <strong>getDocumentTypes</strong> method of the class and add our document type to this print management node. We can do this with the following code:</li>
<li> </li>
</ul>
</li>
</ol>

<pre class="wp-block-code"><code>public List getDocumentTypes()
{
    List docTypes = next getDocumentTypes();
    docTypes.addEnd(PrintMgmtDocumentType::CustomDocument);
    return docTypes;
}</code></pre>



<h2 class="wp-block-heading">Associate our CBD report with a document type</h2>



<p>After finishing the above steps, we will be able to see our custom document type added to the specific module’s print management screen. However, we will still not able to see our custom CBD format in the <strong>Report</strong> <strong>format</strong> field in print management.<br /><br />To achieve this, our next step would be to extend the <strong>PrintMgmtReportFormatPopulator</strong> class, which will allow us to associate our custom CBD formats to our newly created document type. For this purpose, we can use the <strong>addOther </strong>method which takes 4 arguments:             </p>



<ul class="wp-block-list">
<li>PrintMgmtDocumentType enum &#8211; we send our newly added document type</li>



<li>CBD format name</li>



<li>CBD format description</li>



<li>CBD format country/region code</li>
</ul>



<pre class="wp-block-code"><code>[ExtensionOf(classStr(PrintMgmtReportFormatPopulator))]
final class PrintMgmtReportFormatPopulator_Extension
{ 
    protected void addDocuments()
    {
        this.addOther(PrintMgmtDocumentType::CustomDocument, 'Custom format name’, 'Custom format 
        description', 'Custom format country code');
 
        next addDocuments();
    }
}</code></pre>



<h2 class="wp-block-heading">Fetching our CBD format</h2>



<p>Lastly, we need to get the CBD format which is selected for our document type in the print management setup.</p>



<pre class="wp-block-code"><code>public static ERFormatMappingId getFormatMapping()
{
    PrintMgmtDocInstance  printMgmtDocInstance;
    PrintMgmtReportFormat printMgmtReportFormat;
    PrintMgmtSettings     printMgmtSettings;
    ERFormatMappingTable  erFormatMappingTable;

    DataAreaId currentCompany = curExt();

    select firstonly RecId from printMgmtDocInstance
        where printMgmtDocInstance.DocumentType == PrintMgmtDocumentType::CustomDocument
            &amp;&amp; printMgmtDocInstance.PrintType == PrintMgmtDocInstanceType::Original
            &amp;&amp; printMgmtDocInstance.DataAreaId == currentCompany;

    select firstonly Name from printMgmtReportFormat
        where printMgmtReportFormat.DocumentType == PrintMgmtDocumentType::CustomDocument
            exists join printMgmtSettings
               	where printMgmtSettings.ReportFormat == printMgmtReportFormat.RecId
               	    &amp;&amp; printMgmtSettings.ParentId == printMgmtDocInstance.RecId
                    &amp;&amp; printMgmtSettings.DataAreaId == currentCompany;

    select firstonly RecId from erFormatMappingTable
        where erFormatMappingTable.Guid == 
            str2Guid(subStr(printMgmtReportFormat.Name, 21, strLen(printMgmtReportFormat.Name)-1));

    return erFormatMappingTable.RecId;
}
</code></pre>



<p>The above method will return the format mapping object of the CBD format that is set up for our document type. The returned <strong>RecId </strong>can now be used with the following code to create a format mapping object:</p>



<pre class="wp-block-code"><code>ERObjectsFactory::createFormatMappingRunByFormatMappingId(formatMappingId);</code></pre>



<p>These methods can be now used in your electronic reporting classes (service/controller/contract) to run the report.</p>



<h2 class="wp-block-heading">Final thoughts</h2>



<p>After following the steps above steps, we have the framework setup to use a custom CBD with print management:</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="1415" height="748" class="wp-image-1762" style="width: 1064px; height: auto;" src="https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1.png" alt="" srcset="https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1.png 1415w, https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1-300x159.png 300w, https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1-1024x541.png 1024w, https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1-768x406.png 768w" sizes="(max-width: 1415px) 100vw, 1415px" /></figure>



<p>&nbsp;</p>

<p class="has-background" style="background-color: #f9f9d9;">In case we have a custom module where we want to add a new report to print management, we will have to extend the <strong>PrintMgmtNode</strong> class and implement its methods. This will be described in more details in a future post.</p>								</div>
				</div>
				</div>
				</div><p>The post <a href="https://kodeqa.com/how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management/">How to add a custom electronic reporting (ER) CBD report to print management</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
