AL Basics – Part 4 [Page]

Today we will see how to create pages in AL.

Before we dive into it lets have some basic concept for Pages.

If you navigate in Navision you may be familiar with page types we have in Navision.

Types of Page

  • Card Page
  • List Page
  • CardPart Page
  • ListPart Page
  • Worksheet Page
  • Document Page
  • RoleCenter Page
  • Confirmation Dialog Page
  • ListPlus Page
  • StandardDialog Page
  • Navigate Page

All above pages are just how we design and use them for specific purpose, I will not go in details what type of page is used for what purpose you can find them in any document or already familiar with.

When we design pages we should have idea of Page Controls

Different Page Controls you have on pages are:

  • Actions
  • Content Area
  • Factbox Area
  • RoleCenter Area

All controls are placed in pages using below arrangement

Type SubType
   
Container Content Area
  FactBox Area
  RoleCenter Area
   
Group Group (Fast Tabs – on Card Pages)
  Repeater (List Pages)
  CueGroup (Rolecenter Pages)
  FixedLayout
  Grid layout
   
Field Data from Table
   
Part Display another Page, Chart, System defined features

Lets understand from below Customer List Page

Pag-1

Let’s create our First Page.

To Create a Page First we will create a File .al.

In Editor we fill type snippet tpage

You will get the options available, select Page of type list, we are going to create List Page.

Pag-2

Basic structure of the Page is given to you as below

Pag-3

Lets create our LoadoutPointList Page on Table Loadout Point table created in previous post.

Pag-4

Similarly we will create a Appointment Calendar Setup List Page, final code as below:

Pag-5

Similarly you can design Card Page Also:

I am not creating Page from scratch but will show you few properties, triggers from standard Page e.g.:- Cost Type Card

Pag-6

PageType you need to define as Card.

For FastTab you need to define group.

Pag-7

Above is the example of few properties for field control on Page.

Pag-8

To add factboxes to the page you define area(factboxes).

Here systempart for Links & Notes is added.

Pag-9

Above is actions to the page. Few properties how to define.

Pag-10

Above is the Page triggers.

Complete code for each objects is not possible to include in post.

But I will give to some tips using which you can explore equivalent AL Code and tryout them.

Suppose you want to see any feature how implemented in Customer Card.

Export that object as text, and convert using txt2al for equivalent al code.

You can refer back to my previous post Quick Start with Extensions for Business Central

Similar method I have explained in this post.

Pag-11

We will explore few more possibilities and Extending to existing Table & Pages in our upcoming post.

 

Testing Best Practices

There is always trade-off between Quality & Quantity of deliverables.

Sometimes small Partners don’t want to invest on resources and time for their deliverables to make big profits.

Sometimes customers are not interested in paying more for their customizations requested, their after they keep investing on recursive fixes for their solutions.

Sometime requirement is not well aligned with Business Logic and the process keeps refining over the time.

Which leads to arguments on Product capability and Partner Quality of work.

Whatsoever may be the reason but before any piece of code is moved to the Production environment should be well tested and accepted by the clients/customers.

Microsoft recommends the following best practices for designing your application tests:

  • Test code should be kept separate from the code that is being tested. That way, you can release the tested code to a production environment without releasing the test code.
  • Test code should test that the code being tested works as intended both under successful and failing conditions. These are called positive and negative tests. The positive tests validate that the code being tested works as intended under successful conditions. The negative tests validate that the code being tested work as intended under failing conditions.
    • In positive tests, the test function should validate the results of application calls, such as return values, state changes, or database transactions.
    • In negative tests, the test function should validate that the intended errors occur, error messages are presented, and the data has the expected values.
  • Automated tests should not require user intervention.
  • Tests should leave the system in the same well-known state as when the test started so that you can re-run the test or run other tests in any order and always start from the same state.
  • Test execution and reporting should be fast and able to integrate with the test management system so that the tests can be used as check-in tests or other build verification tests, which typically run on unattended servers.
  • Create test functions that follow the same pattern:
    • Initialize and set up the conditions for the test.
    • Invoke the business logic that you want to test.
    • Validate that the business logic performed as expected.

For more details see below Links:

Creating a Test Codeunit and Test Function
Creating a Test Runner Codeunit
Adding a Test to a Test Runner Codeunit

Important

Most of the contents you find in this blog will be either inherited from MSDN or Navision Developer IT Pro Help. Some places images are also directly taken from these sites. Purpose is simple to try those stuffs and re-produce adding few things as per my understanding to make easy understanding for others and quick reference.

Here nothing under my own brand or authorship of the content. At any point of time we are just promoting Microsoft stuffs nothing personnel with same.

Hope stuffs used here will not violate any copyright agreement with them. In case by mistake or in-intestinally it happens and the Microsoft feels these should not be used Microsoft have full right to inform me about same and will be glad to take down any such content which may be violating the norms.

Purpose is to promote Navision and share with community.

FB Profile

Like FB Page

%d bloggers like this: