# Lesson 6: Create a Defined Field (GL Natural Segment)

## Create a New Report

Right-click on the Expense Analysis (Line Item/Export) object and select NEW > REPORT.

• Add the following column to the report as dimensions (BY):
• Header (Segment) - LineItem (Segment) - LineItem_Matter (Segment) - AuditExport (Segment) - GLACCOUNT (Field)

## Open Define Calculation

1. In the Data tab, within the Calculation group, select Detail (Define).
2. In the Detail Field (DEFINE) pop-up window, click on the fx button in the top right corner to display the function list.
3. Expand the Character Legacy folder.
4. Double-click on the SUBSTR function.

## Define the Substring Function

We want to extract the first four characters from the GL Account number.

1. Name the Field Natural.
2. For the SUBSTR function:
3. Change the length to 10 (or the maximum length of the field).
4. Click on the Tree View button.
5. Change the string to Header (Segment) - LineItem (Segment) - LineItem_Matter (Segment) - AuditExport (Segment) - GLACCOUNT (Field).
6. Change start to 1 (the character position that we begin the extraction from).
7. Change end to 4 (the final character position that we are extracting).
8. Change the sublen to 4 (the length of the string). A larger value will result in spaces being added.
9. Change the output_format to Natural (i.e., the name that you determined for the field).
10. The final function should be:
11. SUBSTR ( 10, HEADERLINEEXPORT.AuditExport.GLACCOUNT , 1 , 4 , 4 , Natural)

## Change the Field Format

1. Click on the Format button.
2. Change the Field type to Alphanumeric.
3. Change the Total length to 4.
4. Click OK in the Field Format Options for (Natural) window.
5. Click OK in the Detail Field (DEFINE) window.

## New "Natural" Field and Handling Errors

You should find the new Natural field at the bottom of the AuditExport segment. If the field is not there, scroll to the bottom of all the tables and look there. You can right-click on the Natural field and select Edit if you need to make any changes.

If you receive the following Internet Explorer dialogue box, click NO. You may have to answer no more than once. InfoAssist runs lengthy JavaScripts that sometimes generate this question.

1. Add the new Natural field to the left of the GLAccount field in the Interactive Design View pane.
2. Add Header (Segment) - LineItem (Segment) - LineItem_Matter (Segment) - AuditExport (Segment) - AMOUNTSPENTAPPROVED (field) as a measure.
3. Add Header (Segment) - LineItem (Segment) – LineItemType (Segment) - Expense (field) as a dimension.
4. Subtotal by the Natural field.

## Save the Report

1. In the Quick Access Toolbar, click the Save button. Save the report in this location Content > [Your Company Name] > My Content.
2. Name the report “Lesson 6 – Creating a Defined Field (GL Natural Segment)."
3. Exit InfoAssist.

<% if (allItems.length > 1) { %>

<% } %>
<% var getColumnClasses = function(numberColumns) { var classNames = 'col-12'; if (numberColumns >= 2) classNames += ' md:col-6'; if (numberColumns >= 3) classNames += ' lg:col-4'; if (numberColumns >= 4) classNames += ' xl:col-3'; return classNames; } %>

<% } %>
<% var getColumnClasses = function(numberColumns) { var classNames = 'col-12'; if (numberColumns >= 2) classNames += ' md:col-6'; if (numberColumns >= 3) classNames += ' lg:col-4'; if (numberColumns >= 4) classNames += ' xl:col-3'; return classNames; } %>

<% } %>
<% var maxSections = 5 %>
<% if (sections.length) { %>
<% sections.forEach(function(section) { %>
• <%= partial('partial-article-list-sections', { id: 'section-' + section.id, parentId: '#' + id, sections: section.sections, activeCategoryId: activeCategoryId, activeSectionId: activeSectionId, activeArticleId: activeArticleId, partial: partial }) %> <% if (section.articles.length) { %> <% } %>
• <% }); %>
<% } %>
<% if (sections.length) { %>
<% sections.slice(0, maxSections).forEach(function(section) { %>
• <%= section.name %> <%= partial('partial-section-list-sections', { parent: section, sections: section.sections, maxSections: maxSections, partial: partial }) %>
• <% }); %> <% if (sections.length > maxSections) { %>
• See more
• <% } %>
<% } %>
<% var getColumnClasses = function(numberColumns) { var classNames = numberColumns === 'auto' ? 'col-auto' : 'col-12'; if (numberColumns >= 2) classNames += ' md:col-6'; if (numberColumns >= 3) classNames += ' lg:col-4'; if (numberColumns >= 4) classNames += ' xl:col-3'; return classNames; } %>
<% blocks.forEach(function(block, index) { %>
• <% if (imageHeight) { %> <% } %>
<% if (block.name) { %>

<% if (block.html_url) { %> <%= block.name %> <% } else { %> <%= block.name %> <% } %>

<% } %> <% if (block.description) { %>

<%= block.description %>

<% } %>
• <% }) %>