You are on page 1of 45

Sriram Maringanti ERP-Executive

sriram.msdnav@gmail.com

Basic Navision Technical Interview Questions with solutions

1. Tell me about yourself


2. Currently which project you are working on
3. How many versions you know about Navision
4. Do know about v7.0
5. Do know about Web services
6. Do know RDLC Reports
7. What is difference between Nav 4.0 to Nav 2009?
8. Flow field & Flow Filter
9. Sum Index Field Technology(SIFT)
10.Keys and primary keys in a table
11.Single Instance CodeUnit
12.Dimensions
13.Triggers :- Table,Form,Reports,Dataitem
14.Autosplitkey property()
15.Differences between setrange and setfilter?
16.XML ports
17.BLOB : (Binary Large Object)
18.Types of forms
19.Type of Tables
20.Order of execution of report triggers?
21.-2 Tier Architecture
22.-3 Tier Architecture
23.What is a transfooter and transheader
24.Key Groups
25.Delayed Insert property
26.Totalcaused by
27.Totalfields and Createtotal differences
28.DataPerCompany Property:-
29.Sales Flow
30.Purchase Flow
31.Total Caused By
32.Diff b/w Calcfeilds and Calcsum
33.Diff b/w OnAfterGetRecord and OnAfterGetCurrentRecord
34.Forecolor
35.Focusable,Editable,Delete allowed property
36.Print to Excel Functionality
37.What is NAS
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Microsoft Dynamics NAV

Microsoft Dynamics NAV is an enterprise resource planning (ERP) software product


from Microsoft.

The product is part of the Microsoft Dynamics family, and intended to assist with
finance, manufacturing, customer relationship management, supply chains,
analytics and electronic commerce for small and medium-sized enterprises. Value-
added resellers (VAR)s can have full access to the business logic source code, and it
has a reputation as being easy to customize.

The company was founded in 1983 in Denmark as PC&C A/S (Personal Computing
and Consulting).[2] In 1984 they released their first accounting package called
PCPlus. It was for its time a very user-friendly single user package with all the basic
accounting functionality. In 1987 the first version of Navision was released. [3] This
was also their first client/server based package allowing multiple users to access
the system simultaneous.

Until 1990 the system was primary sold in Denmark, Iceland and Germany. But
with the release of Navision version 3 (of the character-based system) a heavy
international expansion was initiated and distributors and localized versions became
available in many other countries.

In 1995 their first Microsoft Windows 95 based version was released.

In 2000, Navision Software A/S merged with fellow Danish firm Damgaard A/S
(founded 1983) to form NavisionDamgard A/S.[4] Later the name was changed to
Navision A/S.

On 11 July 2002 Microsoft bought Navision A/S to go with its previous acquisition of
Great Plains. The new division in Microsoft was named Microsoft Business Solutions
and also included Microsoft CRM.[5][6]

In 2003 Microsoft announced their plans to develop an entirely new ERP system
(Project green). But later it was decided to continue development of all ERP
systems (Dynamics AX, Dynamics NAV, Dynamics GP and Dynamics SL). All four
ERP systems will be launched with the same new role based user interface, SQL
based reporting and analysis, SharePoint based portal, Pocket PC based mobile
clients and integration with Microsoft Office.

In September 2005 Microsoft re-branded the product and re-released it as Microsoft


Dynamics NAV. [7]
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

In December 2008 Microsoft released Dynamics NAV 2009, which contains both the
original "classic" client, as well as a new three-tier GUI called the RoleTailored
Client (RTC).[8]

The product itself has gone through several name changes over the time. Initially
Navigator was used in Denmark, although most Danes knew it as IBM-Navigator, as
IBM was the distributor. Internationally it was sold as Navision, except for the US
where it was called Avista. The names "Navision Financials", "Navision Solutions",
"Navision Attain", "Microsoft Business Solutions - Navision Edition", and the current
"Microsoft Dynamics NAV" (pronounced N-A-V) have all been used to refer to this
product.

[edit] VersionsWindows based Navision versions from 1.00 onwards were:

Navision Financials 1.00: 1.00, 1.00A, 1.00B, 1.10, 1.10A, 1.20, 1.30

Navision Financials 2.00: 2.00, 2.00A, 2.00B, 2.00C, 2.01, 2.01A, 2.01B

Navision Financials 2.50: 2.50

Navision Financials 2.60: 2.60, 2.60A, 2.60B, 2.60C, 2.60D, 2.60E

Navision Solutions 3.00: 3.00

Navision Attain 3.01: 3.01, 3.01A, 3.01B

Navision Attain 3.10: 3.10, 3.10A, 3.10B

Navision Attain 3.60: 3.60, 3.60A

Microsoft Business Solutions Navision 3.70: 3.70, 3.70A, 3.70B

Microsoft Business Solutions NAV 4.00: 4.00, 4.00 SP1, 4.00 SP2, 4.00 SP3

Dynamics NAV 5.00: 5.00, 5.00 SP1

Dynamics NAV 2009: ("6.00") 2009, 2009 SP1, 2009 R2

Dynamics NAV 2013: ("7.00") 2013

The history of Dynamics NAV / Navision

1983 - The company PC&C was founded founded by Jesper Balser, Peter Bang and
Torben Wind in Copenhagen, Denmark.
1984 - Launch of PCPlus in Denmark & Norway a character-based accounting
solution for SOHO (small office/home office) market.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

1984 - Beauty of Simplicity is the first company slogan.


1987 - Launch of the first version of Navision. This first character-based version
Navision was basically an upgraded version of PCPlus. But the biggest change was
that it was a able to run as client/server application over a LAN, where PCPlus was
a single-user system. In the beginning it was only sold in Denmark and here it
was distributed by IBM to their Erhvervscenters (business centers), who was
required to fulfill a long number of certifications before they where allowed to sell
the product. In Denmark Navision was called Navigator or most often IBM-
Navigator.
1990 - Launch of Navision version 3.0. This was a big change to the previous
versions, as it introduced AL (application language - very similar to C/AL) based
on the Pascal development language. This allowed the user to do very advanced
modifications, compared to both the previous versions (where only reports, tables
and forms could be changed). In fact they where unique in the market at that
time. Only a few years later Navision's biggest competitor at this time, the also
Danish company Damgaard Data, introduced their XAL (extended application
language).
1990 - Market expansion moves beyond Scandinavia into Germany. Spain and the
United Kingdom. Here the name Navision was used for the first time.
1993 - Navision initiates a major development effort to create a new generation of
Navision solutions based on Microsoft Windows 32-bit client/server platform.
1995 - Launch of Navision Financials 1.0, an accounting solution based on
Microsoft Windows 32-bit client/server platform.
1995 - Launch of Navision Financials Windows 95 version and Windows NT.
1995 - The Navision Online User Group is started by Erik P. Ernst.
1997 - Launch of Navision Financials with simple Contact Management / CRM
functionality.
1998 - Launch of Navision Manufacturing.
1999 - Launch of Navision Advanced Distribution.
2000 - Navision Financials receives Microsoft Windows 2000 Professional
Certification and Microsoft Windows 2000 Server Certification.
2000 - Launch of Navision Commerce Gateway worlds first solution based on
Microsofts BizTalk Server.
2000 - Launch of Navision User Portal worlds first solution based on Microsofts
Digital Dashboard
2000 - The two big competitors from Denmark Navision Software a/s and
Damgaard A/S (the developers of Concorde, C4, C5, XAL and Axapta) merge
under the name NavisionDamgaard A/S.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

2001 - Launch of Navision Attain 3.0 which includes:

Re-branding of Navision Financials


Integration of e-commerce applications, Commerce Gateway, Commerce
Portal
User Portal, browser-based access
Supply chain collaboration functionality including manufacturing and
distribution
Extended financial management functionality
Extended and new functionality within customer relationship management
(CRM)
Multicurrency
Multilanguage

2001 - Navision Attain receives Designed for Microsoft XP logo


Awards/Certifications
2001 - The name NavisionDamgaard A/S was changed to the more easy
pronounceable Navision A/S.
2002 - It was not a big surprise when Microsoft Corporation aquires Navision A/S.
Most people had seen it coming. In 2000 Microsoft had a aquired Great Plains,
Navision's biggest competitor on the US market, but the rumors said that
Microsoft had realized that GP was not good enough to base their whole strategy
upon. Navision and Great Plains was put together in a group at Microsoft called
Microsoft Business Solutions and the names changed accordingly to Microsoft
Business Solutions Navision. The domain name of this website also changed from
www.navision.net to www.mbsonline.org.
2003 - Microsoft first starts talking about Project Green. This was an initiative to
merge the platforms of Navision, Axapta, Great Plains and Solomon into one
system. It was first told that the first beta would be available in Q4 2004. But so
far it has not happend and in 2007 Microsoft completely stopped talking about
Project Green, as the they had realized that it would be a much bigger project and
it also scared of a lot of potential customers, who would not invest in a software
with no future.
2005 - Microsoft Business Solutions Navision 4.0 was released.
2005 - Navision version 5.0 was announced as the new big version with a
completely new user interface to be released in late 2006.
2005 - Microsoft changes the names the applications from Microsoft Business
Solutions to Microsoft Dynamics. At the same time the name Navision is changes
to NAV (not nav but n.a.v. - with all letters pronounced).
2006 - Microsoft announces that the new user interface will not be part of Navision
5.0, but instead it will be released 6-12 months later as Dynamics NAV 5.1.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

2007 - Navision version 5.0 was released. But without the new user interface, but
with many new application features such as a completely redesigned Job module.
The job module had basically not changed since the release of Navision 3.01 (the
character based version in 1990).
2008 - First Microsoft announced that the name of the next version of Navision
would not be Navision 5.1, but Dynamics NAV 6.0. Just a few months later they
changed it so that it would be Dynamics NAV 2009 and it would be released in Q4
2008.
2008 - At Convergence in Copenhagen in November 2008 Dynamics NAV 2009
was finally released. Included in the new version was:

The new client is released as the RoleTailored Client and from now on the
old is called the Classic client.
Also introduced with NAV 2009 is the new form object called Pages and the
new RoleTailored reports that you must design using the Visual Studio
Report Designer.

2009 - Dynamics NAV 2009 Service pack 1 was released on September 1st.

Microsoft Dynamics NAV 2009 introduces a service tier and the ability to expose
Codeunits and Pages as web services. The web services can be used by
applications such as InfoPath or Excel to call Navision business logic via codeunits
or read and update data through Page objects.

Different Types of Web Services

Microsoft Dynamics NAV 2009 supports exposing pages and codeunits as Web
services. Pages and codeunits can also be combined to offer even more
functionality on the page Web service.

Page Web Services

When a page is exposed as a Web service, a default set of eight methods is


exposed to developers so that they can manage common record handling, such as
Create, Update, and Read. A page Web service offers the built-in concurrency and
transaction management, as opposed to codeunits.
In connection with page Web services it is possible to use extension codeunits to
extend the default set of methods that are available on a page with codeunit
functionality. Adding an extension codeunit to a page is useful if you want to
perform operations other than CRUD operations on data. The benefits from adding
an extension codeunit to a page is that you get integrated security, as well as
concurrency and transaction management built into the page.
If you want functions from a codeunit to be accessible in a Page Web service, your
codeunit function must have a record variable of type Record and a Subtype which
is the same table as the table that is the source expression for the Page (for
example on the Item Card, the first parameter must be a record variable
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

of subtype Item). The codeunit must also have the same name as that which you
have provided for the Page web service (for example if your Item Card page is
called Items on the Web Services table, your codeunit must also be called
Items). Finally the codeunit should not be ticked as published. When you are
handling the the function call inside the codeunit, the first parameter represents
the record that the function should operate on.

Codeunit Web Services

Codeunit Web services provide the developer with the most control and flexibility
around the behavior of the Web service.
When a codeunit is exposed as a Web service, no default set of methods is
exposed to developers. The methods that should be available on a codeunit are
decided by the developer of the codeunit.
Concurrency is not managed automatically when a codeunit is exposed as a Web
service, each codeunit call is managed as a single transaction.

If you know NAV version 6.0(2009) and above can work even in three tier
environment.

In Three tier environment we have client component called as Role Tailored Client,
the Reports having RDLC layout works from Role Tailored Client.

RDLC is the Layout of Report Definition Language Client-side. As you develop a


report for classic client, for execution of that report in Role tailored client you need
to have RDLC Layout Created.
SumIndex fields are associated with the keys of the table. You can relate
multiple SumIndex fields with a particular key. Each key can have at most 20
SumIndexFields.
SumIndexFields enable fast calculation of numeric columns in tables, even in
tables with thousands of records. This is because SumIndexFields are maintained
when the database record is updated.

SumIndex is a Indexing feature, to enable fast calculations, and the fields are not
ment to be accessed, unlike the FlowFields.

FlowFields are virtual fields in the Table. It is not a permanent part of the table
data. It is used to calculate values from another or same table based on
CalcFormula specified for the field. The information in the FlowFields exists only at
run time.
To update a FlowField you can you CALCFIELDS function as:
record.CALCFIELDS("FieldName")
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

How to define Primary and Secondary Key in Navision


A maximum of 20 distinct fields can be used to define a primary key. The number
of fields used in the primary key limits the number of fields in the secondary keys.
Fields used by one key can also be used in another key; however, no more than
20 unique fields can be used to create primary or secondary keys.
This means that if your primary key includes four distinct fields, your secondary
keys can include these four fields, and at most 16 other fields. Correspondingly, if
your primary key consists of 20 distinct fields, then your secondary keys must
consist only of combinations of these fields.
When you create a table in Table Designer, by default C/SIDE uses the field with
the lowest field number as the primary key. Use the following procedure to define
a different primary key.
To define a primary key
1. On the Tools menu, click Object Designer.
2. Click Table.
3. Select a table from the list and then click Design.
4. Select the first empty line and then from the View menu, click Keys.
5. In the first line of the Keys window, enter the primary key as a comma-
delimited list; for example, "ID Number, Name".
Defining Secondary Keys
Up to 40 keys can be defined for a table. The first key defined is the primary key.
All the other keys are secondary keys and are optional. Secondary keys are used
to view records in an order that is different from the order defined by the primary
key fields.
Single Instance CodeUnit:

When you set this property to Yes on a codeunit, all codeunit variables that use this
codeunit use the same instance. That is, all codeunit variables of this codeunit use
the same set of internal variables when the code is running on the same client. The
codeunit remains instantiated until you close the company.

What is a dimension and a dimension value?

A dimension is data that you can add to an entry as a kind of marker so that the
program can group entries with similar characteristics and easily retrieve these
groups for analysis purposes. Dimensions can be used throughout the program on
entries in journals and documents, as well as budgets. The term dimension is used
in Navision to describe how analysis occurs. A two-dimensional analysis, for
example, would be sales per area. However, by using more than two dimensions
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

when creating an entry, you can carry out a more complex analysis at a later
time, for example, sales per sales campaign per customer group per area.
Each dimension can have an unlimited series of dimension values that are sub-
units of that dimension. For example, a dimension called Department can have
departments called Sales, Administration and so on as subunits. These
departments are dimension values. Dimensions and dimension values are user-
defined and unlimited, which means you can create dimensions tailored to your
company's needs and business processes. However, some dimensions, such as
account number and date, are already defined for you by the program.

Autosplitkey
Autosplitkeys is a form property that automatically generates key values for
primary keys that end with an integer type field. An example is on the sales order
subform. This form is linked to the header table by the document type and
document number, and the autosplitkey generates the line number automatically.
The reason why they selected the number 10000 is because that way you can
insert lines between two existing lines. So if you have line 10000 and line 20000,
the autosplitkey will automatically generate line number 15000 when you insert a
line between those lines.

Autosplitkey:

Sets whether a key is automatically created for a new record placed between the
current record and the previous record.

Skip:

Skips the current iteration of the current dataport, report, or XMLport.

Quit:

Aborts the processing of a dataport, report, or XMLport.

Basically SETFILTER is the Navision function that internally ... sets filters
[Duh!] where as SETRANGE is a function that does multiple things, and is
bassically a parser to the Navison setfilter function.

With Set filter you can do anything you want, but you have to set the
paramaters carefully. SETRANGE just allows you to do short cuts.
SETRANGE is a convenience for the programmer. It maps the parameters
internally to the correct filter expression and calls a filter function - the same
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

one that SETFILTER uses. So SETRANGE is just a wrapper of SETFILTER that


involves an additional c++ function call (not measurable).

BLOB

No performance or funtional difference to be concerned about - its just a


simplification. If you can express your filter with SETRANGE do that,
otherwise use SETFILTER.

A binary large object (BLOB) is a complex data type. Variables of this data type
differ from normal numeric and string variables in that BLOBs have a variable
length.

The maximum size of a BLOB is normally determined by your system's disk storage
capacity. However, the maximum size in C/SIDE is 2 GB.

Difference b/w Two tier and Three tier architecture in navision?


Two Tier Architecture

DB Server <-data-> Client


all needed data from DB are sent to the client which process them
All raw data from DB must be transfered to the Client which will process
them and display them.

Three Tier Architecture

DB Server <-data-> Service tier <-results/inputs-> Client


client sends "only" some request for data, service tier read data from DB
server, process them and only the requested result is sent to the client.
Processing and Presentation is separated and it means that data processing
can run on some fast HW (server) and client is "just" displaying the results
and collect user inputs (and make all needed actions which are needed to
display the data etc.).

Transheader ? Transfooter?
Transheader should be printed before the first line of its dataitem on every page
but the first.
Transfooter should be printed after the last line of the dataitem on every page but
the last.

When do TransHeaders and TransFooters execute in Report Designer?

When the report runtime routine is about to print a BODY section, it checks to see if
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

there is enough room left on the page to print not only the BODY section, but also
the remaining BODY sections from the same DataItem (assuming that
KeepWithNext property is set to Yes), the TransFooter sections for that DataItem,
and any Footers that are set to print at the bottom of the page. If there is enough
room for all of this, it prints the BODY section. If not, it prints the TransFooter and
Footer sections, ejects the page, and prints the Header (assuming they are set to
print on every page) and TransHeader sections at the top of the next page, and
lastly prints the BODY section.

Key Group property

I haven't really used key groups very much in the field.

My understanding is that they were originally used to allow administrators to turn a


set of keys across multiple tables on and off all at once. This would allow you to
save all the space used and performance hit associated with the keys until
absolutely necessary.

Example - you have an annual report that needs to be generated. This report
works across multiple reports and multiple tables and analyzes a lot of data. As this
process only needs to be run once per year why have users have the performance
hit of updating and maintaining those keys all year round. Turn the keys on, run
the year end reporting and then turn them off.

In reality when you enable the keys the database needs to generate those indexes
and that takes time, during which the system may perform poorly. It also assumes
that those keys are only really needed on a periodic basis (i.e. once a year). In the
field I typically see that once a table has a key on it...developers, analysts, report
writers see it and start to use it in reports, forms, processes that are run all the
time, which means they can't be turned off.

When you have a look in the design of a table and open the list of Keys of that table
you will notice that every Key has a KeyGroup property. You can see this property
to specify the predefined key groups that a key belongs to. After you have assigned
a key to one or more key groups, you can selectively activate or deactivate the key
by enabling and disabling the key groups. In the past this was only possible by
going into the Database Key Groups window.

To enable or disable a key group for sorting, click File, Database, Information and
the Database Information window appears:

With key groups, it was possible for the user to manually activate a key before a
run. So for reports, codeunits, etc. which is seldom executed, you would activate
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

the needed key group before execution start. This was though not always an
optimal solution, because the key group could not be activated from code (C/AL),
and therefore the user often did forget to enable it before the big runs.

This has now changed with Dynamics Navision 5

With Navision 5 three new commands was introduced:

KEYGROUPENABLE
KEYGROUPDISABLE
KEYGROUPENABLED

KEYGROUPENABLE can be used for enabling a key group through code, and thereby
you can enable a needed key.

KEYGROUPDISABLE can be used for disabling a key group.

With KEYGROUPENABLED you can check if a key group already is enabled.

So where do we find key groups? Key groups are defined in the table view (File ->
Database -> Information -> Tables, Button Key Groups). Here you can add a new
group, delete groups and enable/disable them.

To add a specific key to a key group, go into the table design and view the keys.
Here you can add the Key Group. If you can not see the field, then it is simple a
hidden column.

Delayed Insert Property

Sets a value that specifies whether a must user leaves a record before it is inserted
into the database. By default, new records are inserted when the user leaves the
control that shows the primary key in the table.

Forms
Pages

Property Value

Yes if the record is inserted when the user leaves the record; otherwise, No if the
record is inserted when the user leaves the control that shows the primary key. The
default value is No.

what property will i change with this scenario

"the program should not insert the record until the user has left the record."
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

I am making a form. So i guess it is in the form properties but not sure what
property to change..

Is it
Insert Allowed?
Delayed Insert?
UpdateOnActivate?

TOTALSCAUSEDBY Function (Report)

Determines which field caused a group total to be calculated. This determines which
field changed contents and thereby concluded a group.

This function can only be used in group header and group footer sections. It is
useful when you have defined several levels of grouping and need to know which of
the groups has changed and caused a group total to be calculated.

This function is not supported on client report definition (RDLC) report layouts.

TotalFields vs CurrReport.CreateTotal
Just like the TotalFields property, CREATETOTALS causes group and grand totals to
be maintained. The totals can be printed by placing controls that have the variable
or variables that are the arguments of CREATETOTALS as their source expressions
in the appropriate sections: the group totals are printed in GroupFooter sections,
and the grand totals are printed in Footer sections.

Report Grouping and Totalling

1) Open the Properties window (SHIFT + F4) of the data item that you want to
group.
2) Enter the name of the field that you want to group by at the GroupTotalFields
property.
3) Select a key for the DataItemTableView property. You must select a key that
contains the field that you want to group by. Otherwise, the grouping won't work.
4) Enter the names of the fields that you want Navision to calculate based on the
grouping. The calculated value can be shown in the Group Footer section.
5) Close the Properties window and open the Layout view.
6) Press F3 to insert a Group Header section.
7) Press F3 to insert a Group Footer section.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

8) Add a field to the Group Header or Group Footer.

CALCFIELDS, CALCSUMS Functions In Navision


CALCFIELDS updates FlowFields. FlowFields are automatically updated when they
are the direct source expressions of controls, but they must be explicitly calculated
when they are part of a more complicated expression.

CALCFIELDS has the following syntax.

[Ok :=] Record.CALCFIELDS(Field1, [Field2],...)


When you use FlowFields in C/AL functions, you must use the CALCFIELDS function
to update them.

For Eg:

In the following example, the SETRANGE function sets a filter and then the
CALCFIELDS function calculates the Balance and Balance Due fields by using the
current filter and performing the calculations that are defined as the CalcFormula
properties of the FlowFields.

Let the Variable Be 'Customer', Data Type be 'Record'.

Customer.GET(INDG-CUS-005); // Will Selct The Customer No: INDG-CUS-005

Customer.SETRANGE("Date Filter",0D,TODAY); // Will set the date Range for the


Present Dt

Customer.CALCFIELDS(Balance,"Balance Due"); // Using, Calcfields system calcs


the balance as per Dt.

MESSAGE('The Balance is %1 and your Balance Due is


%2',Customer.Balance,Customer."Balance Due"); // Will Displays the balance in a
Message Box, with Corresponding Value.

CALCSUMS Function
CALCSUMS calculates the sum of one or more fields that are SumIndexFields in the
record.
CALCSUMS has the following syntax.

[Ok :=] Record.CALCSUMS (Field1, [Field2],...)

For CALCSUMS, a key that contains the SumIndexFields must be selected as the
current key. Similar to CALCFIELDS, CALCSUMS uses the current filter settings
when performing the calculation.

For Eg:
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Let the Variable be 'CustLdgentry' & Datatype be 'Record'

CustLdgentry.SETCURRENTKEY("Customer No."); // will Set the Key Customer No.

CustLdgentry.SETRANGE("Customer No.",'50000','90000');// Will set Range of


Customers No. From 50000-90000.

CustLdgentry.SETRANGE("Posting Date",0D,TODAY); // will Filter the posting date


with Present date.

CustLdgentry.CALCSUMS("Sales (LCY)"); // Will Calculate total Sales Froam


Sales(LCY) Field.

MESSAGE ('%1 calculated sales',custledgerentry."Sales (LCY)") // Total sales


Amount in Local Currency Will be displayed in Message Box.

System-Defined Variables

C/SIDE automatically declares and initializes a number of variables that you can
use when you develop applications. The following details describes the system-
defined variables.
Rec
When a record is modified, this variable specifies the current record, including the
changes that are made.
xRec
When a record is modified, this variable specifies the original values of the record,
before the changes.
CurrForm
This variable specifies the current form. You can access the controls of the form
through this variable and set the dynamic properties of the form and its controls.
CurrReport
This variable specifies the current report.
RequestOptionsForm
This variable specifies the request options form for the current report.
CurrFieldNo
This variable specifies the field number of the current field in the current form.
Retained for compatibility reasons.

GET, FIND, and NEXT Functions


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

The following functions are used to search for records:


. GET

. FIND

. NEXT
These functions are some of the most commonly used C/AL functions. When you
search for records, it is important to know the difference between GET and FIND
and to know how to use FIND and NEXT in conjunction.
GET Function

GET retrieves one record based on values of the primary key fields.

GET has the following syntax.


[Ok :=] Record.GET([Value],...)

For example, if the No. field is the primary key of the Customer table and if you
have created a Record variable called CustomerRec that has a Subtype of
Customer, then you can use GET in the following way:
CustomerRec.GET('4711');

The result is that the record of customer 4711 is retrieved.

GET produces a runtime error if it fails and the return value is not checked by the
code. In the preceding example, the actual code that you write should be similar
to the following.
IF CustomerRec.GET('4711') THEN
.... // Do some processing.
ELSE
.... // Do some error processing.

GET searches for the records, regardless of the current filters, and it does not
change any filters. GET always searches through all the records in a table.

FIND Function

FIND locates a record in a C/SIDE table based on the values stored in the keys.

FIND has the following syntax.


Ok := Record.FIND([Which])

The important differences between GET and FIND are the following:

FIND uses the current filters.


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

FIND can be instructed to look for records where the key value is equal to, greater
than, or smaller than the search string.

FIND can find the first or the last record, depending on the sort order defined by
the current key.

When you are developing applications in a relational database, there are often
one-to-many relationships defined between tables. An example could be the
relationship between an Item table, which registers items, and a Sales Line table,
which registers the detailed lines from sales orders. One record in the Sales Line
table can only be related to one item, but each item can be related to any number
of sales line records. You would not want an item record to be deleted as long as
there are still open sales orders that include the item. You can use FIND to check
for open sales orders.

The OnDelete trigger of the Item table includes the following code that illustrates
using FIND.
SalesOrderLine.SETCURRENTKEY(Type,"No.");
SalesOrderLine.SETRANGE(Type,SalesOrderLine.Type::Item);
SalesOrderLine.SETRANGE("No.","No.");
IF SalesOrderLine.FIND('-') THEN
ERROR(Text001,TABLECAPTION,"No.",SalesOrderLine."Document Type");

NEXT Function

NEXT is often used with FIND to step through the records of a table.

NEXT has the following syntax.


Steps := Record.NEXT([Steps])

In the following example, FIND is used to go to the first record of the table. NEXT
is used to step through every record, until there are no more. When there are no
more records, NEXT returns 0 (zero).
FIND('-');
REPEAT
// process record
UNTIL NEXT = 0;

IF THEN [ELSE]

A conditional statement is one type of control structure in C/AL.


Using Conditional Statements
By using a conditional statement, you can specify a condition and one or more
commands that should be executed, according to whether the condition is
evaluated as TRUE or FALSE. There are two types of conditional statements in
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

C/AL:
1. IF THEN [ELSE], where there are two choices
2. CASE, where there are more than two choices.
IF THEN ELSE Statements
IF THEN ELSE statements have the following syntax.
IF (Condition) THEN (Statement1)
[
ELSE
(Statement2)
]
This means that if (Condition) is true, then (Statement1) is executed. If (Condition)
is false, then (Statement2) is executed.
The square brackets around ELSE mean that this part of the statement is optional.
The ELSE statement is used when different actions are executed, depending on the
evaluation of (Condition).
You can build even more complex control structures by nesting IF THEN ELSE
statements. The following example is a typical IF THEN ELSE statement.
IF (Condition1) THEN
IF (Condition2) THEN
Statement1;
ELSE
Statement2
Note: A semicolon preceding an ELSE is not allowed.
If 'Condition1' is false, then nothing is executed. If 'Condition1' and 'Condition2' are
both true, then 'Statement1' is executed. If 'Condition1' is true and 'Condition2' is
false, then 'Statement2' is executed.
Reading several nested IF THEN ELSE statements can be quite confusing but a
general rule is that an ELSE belongs to the last IF that lacks an ELSE.
Example 1
The following example shows an IF statement without the optional ELSE part.
IF Amount (<) 1000 THEN Total := Total + Amount;
Example 2
The following example shows an IF statement with the optional ELSE part.
(1)...
(2) IF Amount (<1000) align="justify">(3) THEN BEGIN
(4) IF I > J THEN Max := I
(5) ELSE Max := J;
(6) Amount := Amount * Max;
(6) END
(7) ELSE
(8)...
A common error is to put an extraneous semicolon at the end of a line before an
ELSE (line 4). As mentioned earlier, this is not valid according to the syntax of
C/AL. The semicolon is used as a statement separator. (The end of line 4 is inside
the inner IF statement.)
CASE Statements
CASE statements have the following syntax.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

CASE (Expression) OF
(Value set 1) : (Statement 1);
(Value set 2) :(Statement 2);......
(Value set n) : (Statement n);
[ ELSE (Statement n+1) ]
CASE statements are also called multiple option statements and are typically used
when you must choose between more than two different actions.
The function of the CASE statement is as follows:
1. The 'Expression' is evaluated, and the first matching value set executes the
associated statement, if there is one.
2. If none of the value sets matches the value of the expression, and the optional
ELSE part has been omitted, no action is taken. If the optional ELSE part is used,
then the associated statement is executed.
The data type of the value sets must be the same as the data type of 'Expression'
or at least be convertible to the same data type.
For Eg:
The following C/AL code prints various messages depending on the value of
Number. If the value of Number does not match any of the entries in the CASE
structure, the ELSE entry is used as the default.
CASE Number OF
1,2,9: MESSAGE('1, 2, or 9.');
10..100: MESSAGE('In the range from 10 to 100.');
ELSE MESSAGE('Neither 1, 2, 9, nor in the range from 10 to 100.');
END

FOR,WHILE,REPEAT
C/AL Repetitive Statements
A repetitive statement is also known as a loop. The Different Loop statements are
Given below.
1. FOR
2. WHILE
3. REPEAT

FOR
Repeats the inner statement until a counter variable equals the maximum or
minimum value specified.

The Two Control Structures In FOR Statement are FOR TO and FOR DOWNTO.
The Syntax For The above control structures are given below.
FOR [Control Variable] := [Start Number] TO [End Number] DO
[Statement]
The data type of [Control Variable], [Start Number], and [End Number] must be
Boolean, number, time, or date.
Use FOR statements when you want to execute code a specific number of times.
Use a control variable to control the number of times the code is executed. The
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

control variable can be increased or decreased by one, depending on whether TO or


DOWNTO is used.
When using a FOR TO loop, the [Statement] will not be executed if the [Start
Number] is greater than the end value. Likewise, when using a FOR DOWNTO loop,
the [Statement] will not be executed if the [Start Number] is less than the end
value.
For Eg:
1. Consider a variable 'I' for Loop.
FOR I=1 To 5 DO
Statement 1;
2. The following example shows how to nest FOR statements.
FOR I := 1 TO 5 DO
FOR J := 1 TO 7 DO
A[I,J] := 23;

How to Check the User Name Who Locked the Table?.


This is because at same time two different users are trying to modify the values in
same table. For the integerity and security of data, Navision won't allow mutiple
users to modify the values in same table at a time. If You wan't to know,from which
User ID, the sytem had locked it, Please follow the below steps.
Navision allow you to check which user is locking other users.
Step 1 #. Go to File-->Database-->Information.
Step 2 #. Select the Sessions tab.
Step 3#. Drill down to the current sessions.
Step 4#. Check on the Blocking user id column to find out who is locking other
people.

Code Differences in Locking procedure.


Locking Differences in the Code
A typical use of LOCKTABLE(TRUE,TRUE) in Classic Database Server is shown in the
first of the following examples. The equivalent code for the SQL Server Option is
shown in the second example. The code that works on both servers is shown in the
third example. The RECORDLEVELLOCKING property is used to detect whether
record level locking is being used. If this is the case, then you are using the SQL
Server Option for Microsoft Dynamics NAV. This is currently the only server that
supports record level locking.

Classic Database Server


Example 1

IF Rec.FIND('-') THEN
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

REPEAT
UNTIL Rec.NEXT = 0;
Rec.LOCKTABLE(TRUE,TRUE);
IF Rec.FIND('-') THEN
REPEAT
Rec.MODIFY;
UNTIL Rec.NEXT = 0;

SQL Server
Example 2
Rec.LOCKTABLE;
IF Rec.FIND('-') THEN
REPEAT
UNTIL Rec.NEXT = 0;
IF Rec.FIND('-') THEN
REPEAT
Rec.MODIFY;
UNTIL Rec.NEXT = 0;

Both Server Types


Example 3
IF Rec.RECORDLEVELLOCKING THEN
Rec.LOCKTABLE;
IF Rec.FIND('-') THEN
REPEAT
UNTIL Rec.NEXT = 0;
IF NOT Rec.RECORDLEVELLOCKING THEN
Rec.LOCKTABLE(TRUE,TRUE);
IF Rec.FIND('-') THEN
REPEAT
Rec.MODIFY;
UNTIL Rec.NEXT = 0;

The Three Tiers of the RoleTailored Architecture

The RoleTailored architecture is a three-tiered architecture which contains the


following levels:

Presentation level (RoleTailored client)

Business logic and communication level (Microsoft Dynamics NAV Server)


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Data level (SQL Server database)

The different tiers can be installed on different computers. You can have multiple
instances of any of the components (though usually not on the same computer):
multiple clients, multiple servers, and multiple database servers.

"Data Per Company Property"

Sets a value that indicates whether the table data applies to all companies in the
database or only the current company.

When you set the property "DataPerCompany" to FALSE, the data will be "Common
to All Companies".
When you restore a backup into a DB with existing data, it is not possible to check
"Data Common to All Companies".

Sales Flow & Purchase Flow

In no particular order:
Run Planning
Action Suggestions
Load PO's
Process PO's
Process TO's
Process PI
Manufacture
Book into Stock
Manage Inventory
Load Sales Order
Pick SO
Ship SO
Invoice SO
Pay Supplier
Process Customer Payment
Diff b/w OnAfterGetRecord and OnAfterGetCurrentRecord

"OnAfterGetCurrentRecord" is triggered only for the current selected record.


"OnAfterGetRecord" is triggered for ALL records that are shown.

Flow field & Sum Index Field


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Flow field :-
It is a powerful feature of C/side database system.
Underlying concept of SIFT that increase performance.
Flow field data does not gets stored in the data base.

Sum Index Field Technology(SIFT)


It is a decimal field that can be attached to key definition.
Fundamental feature of Navision database that forms basis for
flowfeilds.
Fast calculations.
There can be a maximum of 40 keys to a table.
Primary key can be composed of 20 fields in a record.
Single Instance CodeUnit :

Differences between setrange and setfilter?

- Setrange is quicker than setfilter.


- Set range accepts only a range (From value,to value)
- Setfilter accepts only parameters in string format.
- Setfilter has more features then satrange.

BLOB : (Binary Large Object) :-


Used to store bitmaps and memos. Max size can be 2 GB.

Types of forms:
Card Form
Tabular Form or List Form
Statistics Form
Worksheet From
Line/Header From
Matrix Form
Dialog Form
Request Form
Setup From
Dimensions are used for filter the data.

Table triggers: - Ondelete ()

OnValidate()
OnRename()
OnModify()
OnInsert()
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Form trigger : - OnOpenform ()

OnModifyRecord()
Form-OnInit()
OnOpenForm
OnCloseForm()
OnQuaryCloseForm()
OnActivateForm()
OnDeactiveForm()
OnFindRecord()
OnNextRecord()
OnAfterGetRecord()
OnAfterGetCurrRecord()
OnBeforePutRecord()
OnInsertRecord()
OnModifyRecord()
OnDeleteRecord()
OnTimer
OnCreateHyperlink
OnHyperlink

Field level triggers: - On Activate ()

OnDeactivate()
OnFormat()
OnBeforeInput()
OnInputChange()
OnAfterInput()
OnValidate()
OnAfterValidate()
OnLookUp()
OnDrillDown()
OnAssitEdit()

Report trigger: - Oninitreport ()

OnPrereport()
OnPostreport()
OnCreateHyperlink()
OnHyperlink()

Dataitem trigger: - OnPredataitem ()


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

OnAftergetrecord()
Onpostdataitem()

Autosplitkey property()
- It is mechanism in Navision to generate a number between a previous
and next record.

-2 Tier Architecture

- Two-tier architecture models are used in the true Client/Server


Distributed Data solution.
- In two-tier architectures, the data and data manipulation layers reside
onthe server, whereas the application logic, presentation logic, and
presentation layers reside on the client.
-
- Microsoft Dyanamics NAV 5.0 is designed according to the two-tier
architecture model. It puts the application logic (Business Logic) and
presentation logic/layers (User Interface) on the client computer.
- the two-tier architecture also puts the data and data manipulation layers
(DML) on the server in the native database and SQL Server
configurations.
-3 Tier Architecture

- The three-tier architecture is used in the Client/Server Distributed Data


and Application system. With this architecture, in which the data and data
manipulation layers are put on their own servers, the application logic is
put on its own server, and the presentation and presentation logic are put
on the client.
-
- Microsoft Dynamics NAV 2009 is designed according to the three-tier
architecture model.
- This version puts the presentation logic/ layers (User Interface) on
the client computer.
- It puts the Business logic on another layer available in the three-tier
architecture called the service tier.
- It puts the data and data manipulation layers (DML) on the database
server tier.
- The new three-tier architecture is multithreaded so that it can handle
more than one process at a time. This architecture overcomes the
intrinsic limitations of the two-tier architecture.

Types of Tables and their Characteristics

Master
Contains information about the primary focus subject of its functional area.
Customer, Vendor, Item.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Supplemental
Stores information about a supplemental subject used in one or more
functional areas.
Department, Language, Currency.

Setup
Stores one record that holds general information about its functional area.
G/L Setup, Sales & Receivables Setup.

Register
A "table of contents" for its corresponding Ledger table or tables.
G/L Register, Item Register.

Subsidiary
Contains information which is subsidiary to either a Master table or a
Supplemental table or both.
Item Vendor, FA Depreciation Book.

Ledger
Contains the transactional information that is the primary focus of its
functional area.
Cust. Ledger Entry, Item Ledger Entry.

Journal
The primary transaction entry table for a functional area.
Purchase Journal, Item Journal.

Document
Secondary transactional tables that allow entries in a functional area or into
multiple functional areas at once. This is actually implemented as a pair table.
Sales Header / Sales Line, Finance Charge Memo Header / Finance Charge
Memo Line, Reminder Header / Reminder Line.

Document History
Contains the transaction history for documents that have been posted.
Sales Invoice Header / Sales Invoice Line, Issued Fin. Charge Memo Header /
Issued Fin. Charge Memo Line, Issued Reminder Header / Issued Reminder Line.

MASTER TABLE CHARACTERISTICS


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

A Master table contains information about the primary focus subject of its functional
area.
Other tables are related to a Master table and the Master table is related to other
supplemental tables. (Many-to-Many relationship).

A Ledger table is related to a Master table.


Master tables contain Flow Filters and Flow Fields which relate to corresponding
Ledger table.

Functional areas have 1 Master table. There are cases where there are two Master
tables for a functional area.

Naming Master Tables


Name of this table is name of one of the records in the table.

Primary Key and other Standard Fields


The primary key of a Master table is a Code field of length 20.
The description field of this table is a text field of length 30.
These fields are included in the DataCaptionFields property of the table to display in
the title bar of this table's forms.

Associated Forms
3 forms are used with Master table:

Card form
List form
Statistics form.

The Associated Card Form


Used to edit the records in the Master Table.
Name of this form is name of table + 'Card'.
Has additional button which is labeled the same as the name of the table. This
provides links to other forms.

The Associated List Form


Used to view records in Master Table.
Cannot be used to edit table.
Name of this form is Name + 'List'.
Has at least another menu button which is labeled as name of table. Provides links
to other forms.
The form is set as the LookupFormID and DrillDownFormID property of table.

The Associated Statistics Form


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Used to view calculated information about the record in the Master table. Put on a
separate form for performance reasons.
Name of this form is: Name + 'Statistics'.

SUPPLEMENTAL TABLE CHARACTERISTICS

Supplemental table in which information about a supplemental subject used in one


or more functional areas.

Naming Supplemental Tables


Name of this table is the name of one of the records within the table.

Primary Key and Other Standard Fields


Primary key of supplemental table is a Code field of length 10, named "Code".
Description is Text field of length 30-50, named "Description".
Some Supplemental tables contain a description with name "Name".

Primary Key and Other Standard Fields


Primary key is Code field of length 10 "Code".
Description is Text field of length 30-50 "Description".
Some tables contain name "Name".

Associated Forms
Name of this form is plural of the name of the supplemental table.
This form/s has no extra buttons besides the standard.
This form is set as the LookupFormID property of the table since it is used for
lookups and edits.

SUBSIDIARY TABLE CHARACTERISTICS


Contains information which is subsidiary to master/supplemental table or both.

Primary key and other standard fields


Primary key contains field for each table to which it is subsidiary, each of which is
related to the table.
Primary key can also contain integer as the last field "Line No." to differentiate
multiple records with the exact same subsidiary relationship.
Subsidiary tables are not related to other tables except for primary key fields.
Subsidiary tables do not contain description fields.

Naming subsidiary tables


Name of table/tables to which it is subsidiary.

Associated Forms
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Subsidiary table uses one form for editing and viewing.


This form is called from button on the Master or Supplemental form to which it is
subsidiary.

Name is plural of name of the table.

If primary key for the subsidiary table contains an integer, the form is a worksheet
form which does not contain any primary key fields.
The primary key fields other than the integers are filtered so that they are viewed
and set automatically.

If primary key for subsidiary table does not contain integer, form is a tabular form
and it does not contain primary key field of master table.
This field is filtered so that it viewed and set automatically.

The form is linked back to form that called it up so that so if record is modified,
filters are also changed.
This ensures that correct related records are always in view.

LEDGER TABLE CHARACTERISTICS

Contains information that is primary focus of its functional area.

It is related to Master table.


It is also related to other tables such as supplementary.
Register table are related to Ledger tables but rarely is another table related to
Ledger table.
One Ledger table per functional area, although there may be two.

Naming Ledger Tables

Name of Ledger table is name of Master table to which it is related plus "Ledger
Entry".
When there is more than one Master table, the name is the functional area followed
by "Ledger Entry".

Ledger tables cannot be modified except for exceptions.

Exceptions never include ability to add/delete a record.

Primary key and other standard fields


PK of Ledger Entry is Integer "Entry No.".
PK is generate automatically by the posting routine that controls this Ledger Table.

Field in Ledger table has a relation to Master table associated with this Ledger
table.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Description field is of type text of length 50 named "Description".

Ledger tables have numerous secondary keys. Some of these secondary keys are
sumindex fields.
These are used with FlowFields on the Master table to calculate info for the user.
At least one of the Secondary Keys have the field that is related to the Master table
as the first field in the key.

Associated Forms
Ledger table uses List form to display info.
Form is named with plural of Ledger table.

Form is set as LookupFormID and DrillDownFormID property of the table since it is


used for viewing and Lookups and Drilldowns.

Form displayed from Master table by pressing Ctrl + F5.

REGISTER TABLE CHARACTERISTICS

Register table is a "table of contents" for corresponding ledger table/s.

One record per posting process and Register table corresponds closely to posting
routine rather than functional area.

Naming Register Tables


Register tables are named according to posting function followed by "Register".

User can never modify Register table.

Primary key and other standard fields


PK of Register table is Integer "No."
PK is generated automatically by posting routine that control Register.

Other fields include two fields of type Integer related to corresponding Ledger table
called "From Entry No." and "To Entry No.".

Register tables do not contain description fields.

Associated forms
Register table uses List form to display info. to the user.
Form has same name as Register table.

It contains a Menu button "Register" which contains links to other List forms
displaying corresponding Ledger table/s.

JOURNAL TABLE CHARACTERISTICS


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Journal Table is primary transaction table for functional area.

All transactions pass through this table to eventually be posted to Ledger table.

Journal tables are related to other tables including Master table, Supplemental
tables, Subsidiary tables, and Corresponding Ledger table.

Journal tables have more trigger code than other table types.

Naming Journal Tables


Name is: Name of type of transaction being posted + "Journal Line".

Journal table is related to two corresponding supplemental tables - Journal


Template table and Journal Batch Table.
These tables let users split up data entries in various ways and let them set optional
info. that applies to entire Journal.

Names of these two tables are same as name of Journal Table followed by "Journal
Batch" or "Journal Template".
The two corresponding tables for Resource Journal Line are "Resource Journal
Template" and "Resource Journal Batch".

Primary key and other standard fields


PK for Journal table is made up of three fields:
- Field related to Journal Template table
- Field related to Journal Batch table
- Integer field named "Line No.".
Description field of table is text field of length 50 named "Description".

Associated forms
Form used for Journal table is a worksheet form which is used to make entries to
the table.

Form is named same as table, except without "Line.".


Worksheet form for Resource Journal Line Table is named "Resource Journal".
Form is named for type of data being input.

PK are not included in this form.

When called, it is filtered by Template and Batch fields, and AutoSplitKey property
of worksheet automatically sets Line No. field.

Worksheet form includes a menu button that has same name as Master table.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Call up card form for Master table is triggered by pressing SHIFT + F5.
Call up Ledger for current Master record triggered by pressing CTRL + F5.

Worksheet form includes menu button named posting, which lets user print test
report, post, post and print a register and include choice to reconcile.
Worksheet form includes other buttons that lets user perform various processing
functions.

DOCUMENT TABLE CHARACTERISTICS

Secondary transactional tables that allow entries in a functional area/s at once.


Secondary in that info is posted to ledgers through journal tables.

Primary means of entering data.


They are used for transaction entries.
Document tables have more trigger code than other tables.

Two types of Document tables:

Document header table


Document line table.

Document header table

Holds main transaction info.

Document line table


It holds detailed info for transaction.
Document Line Table is subsidiary to Document Header Table.

Document tables are related to other tables, but other tables are not related to a
document table.

Naming document tables


Name of Document Header Table is name of transaction/document + "Header".

Name of Document Line Table is name of transaction/document + "Line".

Primary key and other standard fields

For Document Header, PK is a code field of length 20 containing Document No. and
name "No.".
Document Header tables contain multiple types of documents referring to same
transaction.

For Document Line tables, PK has two fields - Code field of length 20 containing
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

document no. and Integer field named "Line No.".


Code field is related to Document Header table, and is named according to table's
name followed by table's PK field.

Where the document no. has three fields

Option field named "Document Type"


Code field of length 20 named "Document No."
Integer field named "Line No."

Code field is table related to Document Header Table.

Associated Forms
Document Header table uses card form to display one header record at a time for
user to view and edit info.

Name is name of document it displays.


This is true for multiple types of documents since form is set up to view info from
one type.
It contains tabs to split fields into logical groups.

Document Header includes menu button named "Posting", which lets user print test
reports, post, post and print document, or post a batch of these documents.

Form also includes other buttons that lets user perform various processing
functions.

Difference between Document Header and Card Form is that Document Header
contains a sub-form control, which contains Document Lines form.

A Document Line uses a worksheet form to display multiple line records at a time
for the user to view, and let user edit one at a time.

Name of this form is name of document followed by "Lines/Subform".


What is critical is that size of form is same as size of sub-form control in which it is
displayed.

None of PK fields should be included on this form as form is filtered for all of PK
fields except for Integer field, which is handled by AutoSplitKey property of
worksheet.

Document Header uses List Form to let user view multiple documents at the same
time.

Name of form is name of table without "Header" + "List".


List form is invoked from header form by F5 key.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

DOCUMENT HISTORY TABLE CHARACTERISTICS

When a document is posted, part of posting process is copying document tables to


corresponding document history tables.

Document History Table has same fields with same field numbers, names and
properties as original document tables.

Since document history tables record posted transactions, they are not editable by
user, although they may be deleted.

Document History Tables and forms are the same as corresponding document
tables.

Sub-form is a list form since modifications are not allowed.

Names include either "Posted/Issued" to indicate that it is a history table rather


than a transaction entry table.

SETUP TABLE CHARACTERISTICS

Table that is designed to hold only one record.


This record contains various fields that are used to select options for MS Navision or
to hold data that is applicable to the company as a whole.

No tables are related to setup table, although setup table can be related to other
tables.

Naming setup tables

Name of table is name of functional area, it is meant to set up followed by "Setup".


One exception is Company Information Table.

Primary key and other standard fields

PK is a code field of length 10 named "Primary Key".


It is always blank as only one record per table is allowed.

Associated Setup Form


One form set up for this table and it is a setup form.
Form has same name as table.
PK field is not included in this form.

Types of Forms
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Let us briefly review types of forms that we will use in an application. Then we will
step to several examples using our C/ANDL system to illuminate our path. From an
application design point of view, we need to consider which form type to use under
what circumstances. The following are the different form types:

Card form: These display and allow updating of a single record. A Card form
is generally used for Mastertable and Setup data. Complex cards can contain
a number of tabs, and may even display data from subordinate tables.

Tabular or List form: These display a list of any number of records at one
time, one line per record, with each displayed data field shown as a column.
The Reference table maintenance and inquiry use Tabular forms. List forms
use the same format as Tabular forms but (usually) are not editable. They
can be used, for example, to show a list of master records to allow the user
to compare records or to easily choose one master record on which to focus.
Some specific List forms, such as Ledger Entries, allow editing of some fields
(such as Invoice Due Dates).

Tabular/List forms are widely used as transaction entry forms. One of NAVs
design features is to allow volume data entry activities to be done with little
or no mouse usage. This provides higher data entry speed in situations
where volume entry is feasible.

You can create a version of Tabular forms that is particularly suitable for high
volume data entry into transaction journals. In the NAV documentation these
are referred to as Worksheet Forms. Worksheet forms use
the AutoSplitKey property combined with an integer field as the last field in
the tables primary key. This results in the entered data being automatically
sequenced as it is entered. The C/AL code must handle the incrementing of
the integer field as new records are appended.

The AutoSplitKey property will handle the creation of a new integer for a
record being inserted between two other existing records. It does so by
splitting the number range between the two original records to assign an
integer value to the new, inserted record. For example, if the original records
had keys ending in the values 50000 and 60000, then AutoSplitKey will
assign the value 55000 to the new inserted record key.

A simple tabular form may show all the fields in a reference table to allow
entering data or choosing one entry from among the available set. A complex
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

tabular or list form might show data from several tables and some computed
fields.

Main/Sub or Header/Detail form: This consists of combination of two


forms. The primary form is a card form that contains a subform control. This
control references a secondary form, which is a tabular form. This form type
is often appropriate whenever you have a parent record tied to a subordinate
or child set of data in a one-to-many relationship.

Header/Detail forms are used in Sales and Purchasing functions for Quotes,
Orders, and Invoices, both before and after Posting. Header/Detail forms are
also used in other areas such as Manufacturing Work Orders, Production Bills
of Material, and Production Routings.

Matrix form: This form type display results based on the intersections of
two tables, called the source table and the matrix source table. The display is
in a spreadsheet-style matrix format. The displayed data element of the
source table is the leftmost column. The matrix source table principle data
element is displayed across the top row, in the column header row position,
with the results of the cell source data expression filling out the body of the
matrix.

The actual data displayed for each matrix cell may be computed from the
intersection of these two tables. For it could be from some other table, but
selected based on the results of the intersection of these two tables, for
example, where values from the intersects are used in an algorithm with or
to filter values in other tables.

Trendscape form: This is equipped with Trendscape control buttons, which


allows the displayed data to be filtered by a user selected date range. The
following screenshot shows Trendscape buttons at the bottom of a form:

Trendscape forms may use different form types for the display of date-
filtered data, and several variations occur in the standard NAV system. In
Form 490, the Acc. Schedule Overview, the Trendscape date filter applies to
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

all data appearing on the screen and the form is a Matrix form supplemented
with a Tab control.

[View full size image]

In Trendscape Form 492, Item Availability by Location, shown in the


following screenshot, the date-filtered data is displayed using the subordinate
Form 515, Item Avail. by Location Lines, which is a Tabular form placed in a
subform control on the parent Form 492. All the data being displayed by
Form 492 has the same date filter applied to it. The result is that the form is
displaying the data as of the date filter range.

[View full size image]


Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

In Form 5983, Service Item Trendscape, shown in the following screenshot,


the data is also displayed in a subform control, this time referring to form
5984. This form displays data for one date range on a line. The increment in
the date range from line to line is controlled by the selected Trendscape
button.

[View full size image]

Take a look at these additional standard out-of-the-box forms for a


representative sample of Trendscape forms: Forms 113, 157, 415, 490, 492,
5226, and 5983. You can access all of these forms via Tools | Object
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Designer | Form. Obviously, the data displayed must be time related (e.g.
generally tied to a Posting Date).

Dialog form: This is a simple display form embedded in a process, used to


communicate with user/operator.

Request form: This is a relatively simple form consisting of several tabs,


allowing control information to be entered to control the execution of a report
object.

Print to Excel Functionality

Variables

Name DataType Subtype Length

RecExcelBuffr Record Excel Buffer

PrintToExcel Boolean

-----------------------------------------------------------

Functions

Name

MakeExcelInfo

CreateExcelbook

MakeExcelDataHeader

MakeExcelDataBody

-----------------------------------------------------------

MakeExcelInfo()

RecExcelBuffr.SetUseInfoSheed;

RecExcelBuffr.AddInfoColumn('Company Name',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddInfoColumn(COMPANYNAME,FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.NewRow;

RecExcelBuffr.AddInfoColumn('Report Name',FALSE,'',TRUE,FALSE,FALSE,'');
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

RecExcelBuffr.AddInfoColumn('VAT Exceptions',FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.NewRow;

RecExcelBuffr.AddInfoColumn('Report No.',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddInfoColumn('31',FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.NewRow;

RecExcelBuffr.AddInfoColumn('User ID',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddInfoColumn(USERID,FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.NewRow;

RecExcelBuffr.AddInfoColumn('Date',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddInfoColumn(TODAY,FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.ClearNewRow;

-----------------------------------------------------------

CreateExcelbook()

RecExcelBuffr.CreateBook;

RecExcelBuffr.CreateSheet('Data','VAT Exceptions',COMPANYNAME,USERID);

RecExcelBuffr.GiveUserControl;

ERROR('');

-----------------------------------------------------------

MakeExcelDataHeader()

RecExcelBuffr.NewRow;

RecExcelBuffr.AddColumn('Posting Date',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Document Type',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Document No.',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Type',FALSE,'',TRUE,FALSE,FALSE,'');
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

RecExcelBuffr.AddColumn('Gen. Bus. Posting


Group',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Gen. Prod. Posting


Group',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Base',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Amount',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('VAT Difference',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('VAT Calculation Type',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Bill-to/Pay-to No.',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('EU 3-Party Trade',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Closed',FALSE,'',TRUE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn('Entry No.',FALSE,'',TRUE,FALSE,FALSE,'');

//RecExcelBuffr.AddColumn(Value,IsFormula,CommentText,IsBold,IsItalics,IsUnderl
ine,NumFormat)

-----------------------------------------------------------

MakeExcelDataBody()

RecExcelBuffr.NewRow;

RecExcelBuffr.AddColumn(FORMAT("VAT Entry"."Posting
Date"),FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn(FORMAT("VAT Entry"."Document
Type"),FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn("VAT Entry"."Document
No.",FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn(FORMAT("VAT
Entry".Type),FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn("VAT Entry"."Gen. Bus. Posting


Group",FALSE,'',FALSE,FALSE,FALSE,'');
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

RecExcelBuffr.AddColumn("VAT Entry"."Gen. Prod. Posting


Group",FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn("VAT Entry".Base,FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn("VAT Entry".Amount,FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn("VAT Entry"."VAT
Difference",FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn(FORMAT("VAT Entry"."VAT Calculation


Type"),FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn("VAT Entry"."Bill-to/Pay-to
No.",FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn(FORMAT("VAT Entry"."EU 3-Party


Trade"),FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn(FORMAT("VAT
Entry".Closed),FALSE,'',FALSE,FALSE,FALSE,'');

RecExcelBuffr.AddColumn("VAT Entry"."Entry No.",FALSE,'',FALSE,FALSE,FALSE,'');

-----------------------------------------------------------

VAT Entry, Header (4) - OnPreSection()

IF PrintToExcel THEN MakeExcelDataHeader;

-----------------------------------------------------------

VAT Entry, Body (5) - OnPreSection()

IF PrintToExcel THEN MakeExcelDataBody;

-----------------------------------------------------------

Report - OnPreReport()

IF PrintToExcel THEN

MakeExcelInfo;

-----------------------------------------------------------

Report - OnPostReport()
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

IF PrintToExcel THEN

CreateExcelbook;

-----------------------------------------------------------

FIND

FINDSET: for getting multiple records, you intend to loop through them

FINDFIRST: for getting only the first record in the filter, just one record

FINDLAST: for getting only the last record in the filter, just one record

Specifies how to perform the search. The table is searched until either a record is
found or there are no more records. Each character in this string can be present
only once. You can combine the '=', '<', and '>' characters. You can use the
following characters:

= to search for a record that equals the key values (default)

> to search for a record that is larger than the key values

< to search for a record that is less than the key values

+ to search for the last record in the table (+ can only be used alone)

- tosearch for the first record in the table (- can only be used alone)

If this parameter contains '=', '>' or '<', then you must assign value to all fields of
the current and primary keys before you call FIND.

FIND ('=') is more similar to GET function: the difference between those 2 is that
GET ignores any filter applied to the set

UPDATEFORECOLOR Function (Control)

Dynamically changes the setting of the ForeColor Property property of a control.


UPDATEFORECOLOR(ForeColor)
This function is not supported in the RoleTailored client.
This function can only be called from the OnFormat Trigger trigger of the control
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

Ex:
IF Amount < 0 THEN
CurrForm.Amount.UPDATEFORECOLOR(255);

ForeColor Codes
3268 - light magenta
32768 - green
255 - red
16711680 - dark blue
116687698 - light blue
165458 - light gren
5458 - brown
534458 - shade of red
90000 - light brown
50000825 - very light blue
50000890 - whitish blue
60000826 - peacock blue
963258741 - violet
963258 - greenish yellow
987654321 - purple
XMLports

XMLports was introduced with Navision 4.0 they act like dataports, with a small
difference. They can only be used for XML-formatted data and they must by
executed from some other routine.

What is NAS

NAS is a client without a user interface (GUI), running as a service. Thats all it is.
When it starts, it will run a function in codeunit 1, passing on the Start-up
parameter that has been set up. Thats all it does. There are two prerequisites for
this function in codeunit 1:
It must have ID 99 (the name of the function is irrelevant)
It must have one parameter Text 250. The name of this parameter is also
irrelevant.
Sriram Maringanti ERP-Executive
sriram.msdnav@gmail.com

NAS on its own does not do anything else. So on its own it is a very simple
component. But the application you build around it can, off course, be as
complicated as any other application.

You might also like