What is a Data Element?
Data Elements are the expressions that allow the label to pull data from the Acumatica screen or print hardcoded values onto the label. Instead of writing out the label expressions, data elements break down the expression into different components. By doing so, it makes it easier to create and understand a given element that is to be placed on the label. Data elements are also reusable. Once it is defined, the element can be reused on any label which simplifies the label mapping process.
What makes a Data Element?
All data elements have a Source (Data Source) which dictates where the data originates from. Data can originate from a general global source or from an Acumatica screen or generic inquiry. Data elements are built from the label expressions so they follow an expression type. Consult the Writing Expressions article for more information. So, data elements can be hardcoded fixed values or they can be screen values, whether that be standard data fields, attributes, or user-defined fields. Screen expression types are based on a particular view followed by an expression for the data field. Data elements can also be formatted via a substitution or be data for a particular barcode.
How to create a Data Element?
To create a data element, I would recommend going to the Data Source screen (AL303000) as it is the easiest way to create the data element and it allows you to see elements that are already created. This way, you avoid creating a duplicate of a pre-existing data element. That being said, always check if there isn't already a data element for the data field you wish to create a mapping for. Categories can be assigned to data elements for better organization and easy identification.
In the Data Source of the respective screen (i.e., SO302000 Shipments, IN205000 Stock Items, etc.) different types of data elements can be created.
Screen Data Elements
Screen data elements are data elements where the mapping comes from an Acumatica screen or Generic Inquiry. The screen can be any standard Acumatica screen or even a customized screen.
There are 4 different tabs in screen data elements:
Screens: Data elements that follow the same format as an expression.
Contents: Data elements that make use of content to aggregate multiple data fields together or that abide by a specific 2D barcode sequence.
Functions: Data elements that use a particular function such as a datetime, array, math, or acu function.
Iterators: Data elements that serve as an iterative element for listing data from rows on a detail.
For this article, I will only go into the details for the screens tab as it is the most common implementation of the data elements. When making a screen expression type data element, its composition is very similar to label expressions.
The Based On column is where we input the view/table from which the data fields originate.
The Expression column is where we input the 1st and 2nd level of the data field.
The Sample Type column is the type of values going into the sample value column.
The Sample Based On column is the function that the sample value can be based on (i.e., datetime function).
The Sample Value column is where we input the sample value used in the rendering of the label.
Barcodes and Substitution can be applied directly to the data element such that when using the element on a label model, all that needs to be considered is the font and the positioning of the text.
To attach a barcode to the data element, select the desired barcode using the selector under the Barcode column on the respective data element.
To map a substitution to a data element, check the "Do Substitute" check box then select the desired substitution using the selector under the Substitution column.
Global Data Element
Global data elements are elements that are not pulling data from a particular screen. These values can be hardcoded values, images, or functions.
There are 3 different tabs in global data elements:
Hardcoded: Data elements that are static words. Elements that never change in a label and will always stay the same.
(Note: Hardcoded data elements are a less common practice. It is more efficient to simply write the static value directly on the label model itself.)
Images: Data elements that are images uploaded from the Load Label Files screen (AL101010)
Functions: Data elements that use a particular function such as a datetime, array, math, or acu function.
In the Global source, functions are the least used. Images is the primary use of the Global Source.
To make image data elements, you can click on the Load Images action button in the toolbar. This will pull all the processed image files found in the Load Printer Files (AL101010) screen and automatically create a data element from the files. Another way to create image data elements is to add a new row to the Images tab and select the image file you want to create into a data element. The selection is done from the Printer File column which references the image files uploaded and processed in the Load Printer Files screen.
If an image is too big, using the Size (also called Ratio) column helps scale down the image to a more usable form factor. The ratio for down scaling the image is from 0 to 1 units.
Summary
There are 2 categories of Data Elements: Screen and Global. Screen type Data Elements are expressions that pull value from an Acumatica screen. The value printed on the label will change depending on the data that is in the system. Global type Data Elements are fixed expressions that will never change when printed on the label.