Share This Post

AL Programming for Dynamics Business Central On Premises

In this post, we will explain about How to Use the Dictionary, RecordID, RecordRef, and BigText Data and also the Types in AL Programming for Dynamics Business Central On Premises.

There are many data types that are used in the AL programming language, used to modify code in Microsoft Dynamics Business Central On Premises. This blog explains how to use the Dictionary, RecordID, RecordRef, and BigText data types.

Dictionary Data Type

The Dictionary data type represents a collection of keys and values. Dictionary made of a value and its associated key. Every key in a Dictionary must be unique. Following is an example:

  1. Create a codeunit using the ‘tcodeunit’ snippet and then provide the ID number and name of the codeunit.
  2. Create a procedure using the ‘tproceure’ snippet.

The variable mycustomers represents Dictionary data types:

  1. Each addition to the Dictionary consists of a value and its associated key.
  2. Every key in a Dictionary must be unique.
  3. A key cannot be null, but a value can be, only when the value type is a reference type.

In the above scenario, we are storing customer number and name and presenting the name of that specified customer by the Message function.

RecordID & RecordRef

Record Ref references a record in a table. There are many records available; some are presented below:

Number Method: Identify the number of records

Syntax:    No: = RecordRef.Number()

Name Method: Identify the name of the record

Syntax: Name := RecordRef.Name()

Record ID contains the table number and primary key of a table. Two instances are there.

Table no() : provides the table number of the table that is identified by the Record ID.

Get Record (): Gets a RecordRef that refers to the record identified by the Record ID.

  1. Create a codeunit to show an instance.
  2. Let’s go through an example of the table no.

BigText Data Types

The BigText data type handles large text documents. There are many methods available; three of them presented below.

AddTextMethod : Add text to the string.

Syntax : BigText.AddText(String: String, [Position: Integer])

Length () : Retrieves the length.

Syntax : Length :=   BigText.Length()

Textposition : Gets the position at which a specific string first occurs in this BigText instance

Syntax : Position :=   BigText.TextPos(String: String)

GetSubtext : Gets part of a BigText variable

Syntax : [Length := ]  BigText.GetSubText(var Variable: BigText, Position: Integer, [Length: Integer])

If you have any questions about this or other Microsoft Dynamics NAV or Business Central topic for any version, contact us.

Share This Post

Leave a Reply

avatar
  Subscribe  
Notify of
Skip to toolbar