SlideShare a Scribd company logo
1 of 45
Dynamics NAV 2013
Shan Abeywicrema | Jinasena Infotech | jinasenainfotech.com
 Client Application Language (C/AL) is the
programming language that is used in the
Microsoft Dynamics NAV 2013 Development
Environment.
 Design custom functions.
 Connect database objects.
 Read, write, and change data.
 Data Manipulation
 Add new data or transfer data from one table
to another, such as transferring from a
journal table to a ledger table.
 Combine data from multiple tables into one
report or display it on one page
 The codeunit object is used only for
programming
 Codeunits consist of programming language
statements, also known as C/AL statements
or code.
 DateFilter-Calc codeunit
 Click Tools> Object Designer.
 Click Codeunit to open the codeunit list.
 Select codeunit 358, DateFilter-Calc, and
then click Design to design the DateFilter-
Calccodeunit.
 Click View > C/AL Code
 Click the C/AL Code button on the Toolbar.
 Press F9.
 Each shaded bar in the codeunit is known as
a trigger.
 There are three types of Triggers
◦ Documentation trigger
Use documentation triggers to write documentation for a
particular object. It is not executing when run. Only for
Documentation purpose.
◦ Event triggers
Event trigger names always starts with the word On
OnRun
◦ Function Triggers
Developers create these triggers when they create
a function in an object
DateFilterCalc codeunit has three function triggers: CreateFiscalYearFilter,
CreateAccountingPeriodFilter, and CreateAccountingDateFilter.
 Access C/AL code in the Customer table.
 Constants are data values that are written
directly into programming statements.
 They are called constants because their
values never change while the application is
running.
 Data are pieces of information
 Data types are the classifications of this
information.
 Different data types have different values and
different meanings for those values.
 25,20 [Integer Type]
25+20 =45
 25,20 [String/Text Type]
25+20=2520
 Numeric data types are all forms of numbers
or amounts.
 Integer
An integer is a whole number that can range
in value from -2,147,483,647 to
+2,147,483,647
 The default value of an integer is zero
 12 , 100 , -100 , 0
 BigInteger is used to store large whole
numbers.
 Add an “L” to the constant definition to
inform C/AL that an integer must be
interpreted and treated as a BigInteger.
 1L
 455500000000L
 A decimal is a whole or fractional number
 The default value of a decimal is zero
 12.50 , 0.005
 An option is a special kind of integer that
enables developers to define words for each
value
 Example
Gender : Male, Female
The default value of an option is zero
 A char is a single character
 For syntax purposes, it is considered as a
numeric data type and can have integer
values from zero to 255
 'b' (with single quotation marks surrounding
the character)
 String data is data that is made up of strings
of characters.
 Text
A text is a string of either specified or unlimited length. If you
specify the length, then a text can contain up to 1024
characters
If you do not specify the length of a text variable, then it is of
unlimited length. A text variable of unlimited length can
contain up to 2GB (gigabytes) of data.
 'Hello‘
 '127.50' (This resembles a number but
because it is enclosed in quotation marks, it
is a text.)
 '' (This is an empty, 0 length text.)
 ' spaces before ... and after ‘
 A code is a special kind of text.
 Code cannot be of unlimited length
 All letters in a code convert automatically to
uppercase and all leading and trailing spaces
are removed.
 'HELLO‘
 'SPACES BEFORE ... AND AFTER‘
 Boolean data, also known as logical data, is
the simplest type of data. The constants of
type Boolean in C/AL are as follows
 TRUE | FALSE
 Date
Date is a calendar date that can range in value
from 1/3/0001 to 12/31/9999.
 123197D (December 31, 1997)
 030595D
 0D (The undefined date, less than all other
dates)
 The Date data type is defined by using a D at
the end. If there is no D, then C/AL assumes
that it is an integer
 A Time data type represents the time of day,
and not a time interval.
 103000T (10:30am)
 154530T (3:45:30pm)
 030005.100T (3:00:05.1am)
 0T (The undefined time, less than all other
times)
 C/AL also contains several complex data
types. Developers use complex data types
when they work with records in tables,
pictures (bitmaps), or disk files. Because C/AL
is object-based, each complex data type can
include both member variables and member
functions..
 The Record data type is a complex data type
that consists of several simpler elements
called fields
 It corresponds to a row in a table
 SalesLine.”No.”
 The Page data type stores pages
 This is a complex data type and can contain
several simpler elements called controls
 The Codeunit data type stores codeunits. This
is a complex data type that can contain
several user-defined functions
 The File data type gives developers access to
operating system files
 File.Open();
Example Report ID 15
 The Dialog data type stores dialog windows.
Several functions are available for
manipulating dialog boxes
 The Report data type stores reports. This is a
complex data type that can contain several
simpler elements called controls. Controls
display information to the user
 Check Report 1401
Amounts Convert to Word (FormatNoText)
 The DateFormula data type provides
multilanguage capabilities to the CALCDATE
function
 The Globally Unique Identifier (GUID) data
type gives a unique identifying number to any
database object.
 Applies a filter to another table. Currently,
this data type can only be used when you are
setting security filters from the Permission
table.
 The RecordRef data type is a complex data
type that identifies a row in a table.
 Each record consists of fields that form the
columns of the table. A record holds
information about a fixed number of
properties
 recordref12.OPEN(DATABASE::Customer);
MESSAGE('The %1 table contains %2
records',recordref12.CAPTION,
recordref12.COUNTAPPROX);
 The RecordID data type is a complex data
type that contains the table number and the
primary key of a table. You can store a
RecordID in the database, but you cannot set
filters on a RecordID
 An identifier is a name that identifies or labels
either a unique object or a unique class of
objects. Objects, variables, fields, and functions
all have identifiers. Some items in a program do
not have identifiers, such as constants,
operators, and certain reserved words. Instead,
these items are referred to directly. Programming
elements that refer to data stored in memory
require an identifier to access the data;
programming elements that exist in the
programming code itself do not refer to data and
therefore do not need an identifier.
 A variable is a value that may change within
the scope of a given set of operations.
 Integer number=10;
 String name=“Saman”;
 Double InvoiceVal=1000.00;
 Syntax is a set of grammatical rules that
defines the programming language.
Programming lines or code that follow these
rules are said to follow the correct syntax.
The computer does not understand code that
does not follow the correct syntax and does
not compile or execute the code.
 A variable scope is the context within a
computer program in which a variable name
or other identifier is valid and can be used.
 A variable has a global scope if it can be
accessed anywhere in an object.
 A variable has a local scope if it can only be
accessed in a single trigger in an object
 Certain variables are automatically defined
and maintained by the system. An example is
Rec, which is found in table objects. Each
object has its own set of system defined
variables. Developers can use these variables
without creating them or initializing their
values.
 In C/AL, you do not have to explicitly
initialize a variable before you can use it.
 Before any C/AL code runs, all the variables
are initialized with their default values.
 For any numeric variables, the value is zero
(0).
 For string variables, the value is an empty
string (")
INTRODUCTION TO C

More Related Content

What's hot

datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c languageRai University
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C ProgrammingKamal Acharya
 
Complete Tokens in c/c++
Complete Tokens in c/c++Complete Tokens in c/c++
Complete Tokens in c/c++Shobi P P
 
3 data-types-in-c
3 data-types-in-c3 data-types-in-c
3 data-types-in-cteach4uin
 
User define data type In Visual Basic
User define data type In Visual Basic User define data type In Visual Basic
User define data type In Visual Basic Shubham Dwivedi
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++ Hridoy Bepari
 
C data types, arrays and structs
C data types, arrays and structsC data types, arrays and structs
C data types, arrays and structsSaad Sheikh
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++Neeru Mittal
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic Manzoor ALam
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in cyash patel
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ LanguageWay2itech
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++Ameer Khan
 

What's hot (20)

datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
C tokens
C tokensC tokens
C tokens
 
Complete Tokens in c/c++
Complete Tokens in c/c++Complete Tokens in c/c++
Complete Tokens in c/c++
 
3 data-types-in-c
3 data-types-in-c3 data-types-in-c
3 data-types-in-c
 
User define data type In Visual Basic
User define data type In Visual Basic User define data type In Visual Basic
User define data type In Visual Basic
 
Word processing
Word processingWord processing
Word processing
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
Data types in C
Data types in CData types in C
Data types in C
 
Data types
Data typesData types
Data types
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++
 
C data types, arrays and structs
C data types, arrays and structsC data types, arrays and structs
C data types, arrays and structs
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
 
Data types
Data typesData types
Data types
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
 
Data type
Data typeData type
Data type
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++
 
Data types
Data typesData types
Data types
 

Similar to INTRODUCTION TO C

Sterling Integrator Map Editor
Sterling Integrator Map EditorSterling Integrator Map Editor
Sterling Integrator Map EditorJeyhind M
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.pptAqeelAbbas94
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction toolssunilchute1
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptxmadhurij54
 
Notes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculationsNotes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculationsWilliam Olivier
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfAbrehamKassa
 
Programming concepts By ZAK
Programming concepts By ZAKProgramming concepts By ZAK
Programming concepts By ZAKTabsheer Hasan
 
Fundamentals of c language
Fundamentals of c languageFundamentals of c language
Fundamentals of c languageAkshhayPatel
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...Rowank2
 
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptxchapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptxAmrutaNavale2
 
Semester-1-22-23-Introduction_to_c_programming.ppt
Semester-1-22-23-Introduction_to_c_programming.pptSemester-1-22-23-Introduction_to_c_programming.ppt
Semester-1-22-23-Introduction_to_c_programming.pptChetanChauhan203001
 

Similar to INTRODUCTION TO C (20)

Sterling Integrator Map Editor
Sterling Integrator Map EditorSterling Integrator Map Editor
Sterling Integrator Map Editor
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
C
CC
C
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction tools
 
C#
C#C#
C#
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Pc module1
Pc module1Pc module1
Pc module1
 
C intro
C introC intro
C intro
 
Notes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculationsNotes how to work with variables, constants and do calculations
Notes how to work with variables, constants and do calculations
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdf
 
Data types
Data typesData types
Data types
 
Programming concepts By ZAK
Programming concepts By ZAKProgramming concepts By ZAK
Programming concepts By ZAK
 
Fundamentals of c language
Fundamentals of c languageFundamentals of c language
Fundamentals of c language
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
 
C++
C++C++
C++
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptxchapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
 
Semester-1-22-23-Introduction_to_c_programming.ppt
Semester-1-22-23-Introduction_to_c_programming.pptSemester-1-22-23-Introduction_to_c_programming.ppt
Semester-1-22-23-Introduction_to_c_programming.ppt
 

INTRODUCTION TO C

  • 1. Dynamics NAV 2013 Shan Abeywicrema | Jinasena Infotech | jinasenainfotech.com
  • 2.  Client Application Language (C/AL) is the programming language that is used in the Microsoft Dynamics NAV 2013 Development Environment.
  • 3.  Design custom functions.  Connect database objects.  Read, write, and change data.  Data Manipulation  Add new data or transfer data from one table to another, such as transferring from a journal table to a ledger table.  Combine data from multiple tables into one report or display it on one page
  • 4.  The codeunit object is used only for programming  Codeunits consist of programming language statements, also known as C/AL statements or code.
  • 5.  DateFilter-Calc codeunit  Click Tools> Object Designer.  Click Codeunit to open the codeunit list.  Select codeunit 358, DateFilter-Calc, and then click Design to design the DateFilter- Calccodeunit.
  • 6.
  • 7.  Click View > C/AL Code  Click the C/AL Code button on the Toolbar.  Press F9.
  • 8.  Each shaded bar in the codeunit is known as a trigger.
  • 9.  There are three types of Triggers ◦ Documentation trigger Use documentation triggers to write documentation for a particular object. It is not executing when run. Only for Documentation purpose. ◦ Event triggers Event trigger names always starts with the word On OnRun ◦ Function Triggers Developers create these triggers when they create a function in an object DateFilterCalc codeunit has three function triggers: CreateFiscalYearFilter, CreateAccountingPeriodFilter, and CreateAccountingDateFilter.
  • 10.  Access C/AL code in the Customer table.
  • 11.
  • 12.  Constants are data values that are written directly into programming statements.  They are called constants because their values never change while the application is running.
  • 13.  Data are pieces of information  Data types are the classifications of this information.  Different data types have different values and different meanings for those values.  25,20 [Integer Type] 25+20 =45  25,20 [String/Text Type] 25+20=2520
  • 14.
  • 15.  Numeric data types are all forms of numbers or amounts.  Integer An integer is a whole number that can range in value from -2,147,483,647 to +2,147,483,647  The default value of an integer is zero  12 , 100 , -100 , 0
  • 16.  BigInteger is used to store large whole numbers.  Add an “L” to the constant definition to inform C/AL that an integer must be interpreted and treated as a BigInteger.  1L  455500000000L
  • 17.  A decimal is a whole or fractional number  The default value of a decimal is zero  12.50 , 0.005
  • 18.  An option is a special kind of integer that enables developers to define words for each value  Example Gender : Male, Female The default value of an option is zero
  • 19.  A char is a single character  For syntax purposes, it is considered as a numeric data type and can have integer values from zero to 255  'b' (with single quotation marks surrounding the character)
  • 20.  String data is data that is made up of strings of characters.  Text A text is a string of either specified or unlimited length. If you specify the length, then a text can contain up to 1024 characters If you do not specify the length of a text variable, then it is of unlimited length. A text variable of unlimited length can contain up to 2GB (gigabytes) of data.
  • 21.  'Hello‘  '127.50' (This resembles a number but because it is enclosed in quotation marks, it is a text.)  '' (This is an empty, 0 length text.)  ' spaces before ... and after ‘
  • 22.  A code is a special kind of text.  Code cannot be of unlimited length  All letters in a code convert automatically to uppercase and all leading and trailing spaces are removed.  'HELLO‘  'SPACES BEFORE ... AND AFTER‘
  • 23.  Boolean data, also known as logical data, is the simplest type of data. The constants of type Boolean in C/AL are as follows  TRUE | FALSE
  • 24.  Date Date is a calendar date that can range in value from 1/3/0001 to 12/31/9999.  123197D (December 31, 1997)  030595D  0D (The undefined date, less than all other dates)  The Date data type is defined by using a D at the end. If there is no D, then C/AL assumes that it is an integer
  • 25.  A Time data type represents the time of day, and not a time interval.  103000T (10:30am)  154530T (3:45:30pm)  030005.100T (3:00:05.1am)  0T (The undefined time, less than all other times)
  • 26.  C/AL also contains several complex data types. Developers use complex data types when they work with records in tables, pictures (bitmaps), or disk files. Because C/AL is object-based, each complex data type can include both member variables and member functions..
  • 27.  The Record data type is a complex data type that consists of several simpler elements called fields  It corresponds to a row in a table  SalesLine.”No.”
  • 28.  The Page data type stores pages  This is a complex data type and can contain several simpler elements called controls
  • 29.  The Codeunit data type stores codeunits. This is a complex data type that can contain several user-defined functions
  • 30.  The File data type gives developers access to operating system files  File.Open(); Example Report ID 15
  • 31.  The Dialog data type stores dialog windows. Several functions are available for manipulating dialog boxes
  • 32.  The Report data type stores reports. This is a complex data type that can contain several simpler elements called controls. Controls display information to the user  Check Report 1401 Amounts Convert to Word (FormatNoText)
  • 33.  The DateFormula data type provides multilanguage capabilities to the CALCDATE function
  • 34.  The Globally Unique Identifier (GUID) data type gives a unique identifying number to any database object.
  • 35.  Applies a filter to another table. Currently, this data type can only be used when you are setting security filters from the Permission table.
  • 36.  The RecordRef data type is a complex data type that identifies a row in a table.  Each record consists of fields that form the columns of the table. A record holds information about a fixed number of properties  recordref12.OPEN(DATABASE::Customer); MESSAGE('The %1 table contains %2 records',recordref12.CAPTION, recordref12.COUNTAPPROX);
  • 37.  The RecordID data type is a complex data type that contains the table number and the primary key of a table. You can store a RecordID in the database, but you cannot set filters on a RecordID
  • 38.  An identifier is a name that identifies or labels either a unique object or a unique class of objects. Objects, variables, fields, and functions all have identifiers. Some items in a program do not have identifiers, such as constants, operators, and certain reserved words. Instead, these items are referred to directly. Programming elements that refer to data stored in memory require an identifier to access the data; programming elements that exist in the programming code itself do not refer to data and therefore do not need an identifier.
  • 39.  A variable is a value that may change within the scope of a given set of operations.  Integer number=10;  String name=“Saman”;  Double InvoiceVal=1000.00;
  • 40.  Syntax is a set of grammatical rules that defines the programming language. Programming lines or code that follow these rules are said to follow the correct syntax. The computer does not understand code that does not follow the correct syntax and does not compile or execute the code.
  • 41.  A variable scope is the context within a computer program in which a variable name or other identifier is valid and can be used.
  • 42.  A variable has a global scope if it can be accessed anywhere in an object.  A variable has a local scope if it can only be accessed in a single trigger in an object
  • 43.  Certain variables are automatically defined and maintained by the system. An example is Rec, which is found in table objects. Each object has its own set of system defined variables. Developers can use these variables without creating them or initializing their values.
  • 44.  In C/AL, you do not have to explicitly initialize a variable before you can use it.  Before any C/AL code runs, all the variables are initialized with their default values.  For any numeric variables, the value is zero (0).  For string variables, the value is an empty string (")