Escolar Documentos
Profissional Documentos
Cultura Documentos
December 2010
Contents
Developer Updates for Microsoft Dynamics NAV 2009 R2 ............................................................. 1
Viewing the Definition of a Function or Object by Using Go To Definition ................................... 2
Locking and Unlocking Objects .................................................................................................... 9
How to: Lock an Object ........................................................................................................... 10
How to: Unlock an Object ....................................................................................................... 11
How to: Integrate Classic Client Report Designer and Visual Studio Report Designer ............. 12
Extending Microsoft Dynamics NAV Using Microsoft .NET Framework Interoperability ........... 14
Calling .NET Framework Members from C/AL Code.............................................................. 15
How to: Call .NET Framework Members from C/AL Code .................................................. 18
How to: Set .NET Framework Types to Target the RoleTailored Client or Microsoft
Dynamics NAV Server ..................................................................................................... 21
.NET Framework and C/AL Type Mappings ........................................................................... 23
Using .NET Framework Arrays ............................................................................................... 26
Using .NET Framework Collections ........................................................................................ 30
Using .NET Framework Enumerations ................................................................................... 31
Using .NET Framework Generics ........................................................................................... 33
Using .NET Framework Interfaces.......................................................................................... 35
Calling External Web Services with Windows Communication Foundation ........................... 36
How to: Add a FactBox on a Page Using the Wizard ................................................................ 38
How to: Use the System Indicator .............................................................................................. 40
In This Section
Viewing the Definition of a Function or Object by Using Go To Definition
Locking and Unlocking Objects
How to: Integrate Classic Client Report Designer and Visual Studio Report Designer
Extending Microsoft Dynamics NAV Using Microsoft .NET Framework Interoperability
How to: Add a FactBox on a Page Using the Wizard
How to: Use the System Indicator
Right-click the function name or object variable name, and then click Go To Definition.
Press SHIFT+F12.
The following table describes how you can go to the definition of a function or object.
Starting location
Result
The C/AL Editor goes to the C/AL code that defines the
selected function.
The C/AL Editor goes to the C/AL code that defines the
selected function.
Record
Table Designer
Page
Page Designer
Form
Form Designer
Report
Report Designer
Codeunit
C/AL Editor
Dataport
Dataport Designer
XMLport
XMLport Designer
Note
If you select a variable that is a fundamental
data type, such as Integer or Decimal, then
information about the variable is displayed in the
status bar.
Examples
This section shows examples of using the Go To Definition shortcut menu item.
The result is that the C/AL Editor jumps to the C/AL code that defines the selected function.
The result is that the C/AL Editor jumps to the C/AL code that defines the selected function.
The result is that the object on which the function is called is opened in the corresponding designer and a
new C/AL Editor window opens to the C/AL code that defines the selected function.
If the system function is called on a record variable, then the table that the record is from is opened in
Table Designer.
If the system function is the <codeunit>.RUN function, then the codeunit is opened in a new C/AL Editor
window.
6
If the system function is called on any other object type variable, then the object is opened in the
corresponding designer. For any other system function that is not called on an object variable, nothing
happens.
Record
Page
Form
Report
Codeunit
Dataport
XMLport
Table Designer
Page Designer
Form Designer
Report Designer
C/AL Editor
Dataport Designer
XMLport Designer
Permissions
To go to a definition, you must have the correct permissions. If you do not have permission to view the
definition of an object by selecting the object in Object Designer and then clicking Design, then you
cannot view it with the Go To Definition option.
Open the object in the designer, make changes, and compile the object. However, another user
cannot save the object. The locked object is marked as Read Only when another user opens it in the
designer.
Run the object. For example, a user can run a table and can add or delete records in the table even if
it is locked for design changes.
When you finish making design changes to an object, you can unlock it in Object Designer. The Locked
and Locked By fields are cleared, and other users can now lock the object or save changes to the object.
You can select one object or multiple objects at the same time to lock or unlock. You can also set the
Auto-Lock on Design option to automatically lock all objects that you open for designing.
Object Table
The information in the Locked and Locked By columns is stored in the Object table. The Object table is
a system table that stores information about objects in the application.
Concurrency Considerations
Even though you can lock objects, it is still possible for developers to have concurrency issues, as shown
in the following examples.
A developer opens an object in the designer but does not lock it. The developer makes several
changes to the object and saves the changes periodically. At the same time, a second developer
locks the object, and the first developer cannot save design changes to the object. The first developer
gets an error message that the object is locked by the second developer.
A developer locks an object. A second developer opens the locked object in read-only mode, and
then the first developer unlocks the object. The second developer still cannot save design changes to
the object even though the object is now unlocked because it is open in read-only mode.
See Also
How to: Lock an Object
How to: Unlock an Object
Press CTRL+ALT+L.
See Also
How to: Unlock an Object
Locking and Unlocking Objects
10
Press CTRL+ALT+U.
Press CTRL+ALT+U.
See Also
How to: Lock an Object
Locking and Unlocking Objects
DEVELOPER UPDATES FOR MICROSOFT DYNAMICS NAV 2009 R2
11
Before you switch from Visual Studio Report Designer to Classic client Report Designer, save the
report.rdlc file. You can also build the report in Visual Studio before you switch to the Classic client,
but this is not required.
Before you switch from Classic client Report Designer to Visual Studio Report Designer, save and
compile the report.
After you update the dataset in Classic client Report Designer, you must refresh the dataset result in
Visual Studio Report Designer. In the Website Data Sources pane, expand DataSet, right-click
Result, and then click Refresh.
If you rename a field in Classic client Report Designer, then you must update all instances of that field
in the Visual Studio Report Designer layout. Otherwise, the report will not successfully compile.
If you delete a field in Classic client Report Designer, then you must delete all instances of that field in
the Visual Studio Report Designer layout. Otherwise, the report will not successfully compile.
The following procedure describes how to switch between Classic client Report Designer and Visual
Studio Report Designer.
To work with both Object Designer and Visual Studio Report Designer
1. In the Classic client, on the Tools menu, click Object Designer.
2. To either create or modify an RDLC report, do one of the following steps:
To create a new RDLC report layout for a report, in Object Designer, click Report, select
the report, and then click Design. On the Tools menu, click Create Layout Suggestion.
To modify an existing RDLC report layout for a report, in Object Designer, click Report,
select the report that you want to modify, and then click Design. On the View menu, click
Layout.
3. After you make changes in the RDLC layout, in Visual Studio, on the File menu, click Save
Report.rdlc.
4. In the Classic client, select an empty line in the report in Report Designer. A dialog box opens
with the following message:
The layout of report id: '<report ID>' is changed by another application.
Filename of the changed RDLC: <filename>
Do you want to load the changes?
12
5. Click Yes to load the changes that you made to the RDLC layout into the Classic client.
6. In the Classic client, on the File menu, click Save.
7. In the Save dialog box, select Compiled, and then click OK.
Note
If you try to close the report in Object Designer in the Classic client, then you see the
following error: You must close the Visual Studio Designer window before closing
the report object.
Note
If you try to view the layout when the report layout is already open, then you see the
following error: The report layout is already open in Visual Studio.
8. In Classic client Report Designer, make some additional changes to the report dataset.
9. In the Classic client, on the File menu, click Save.
10. In the Save dialog box, select Compiled, and then click OK.
Important
If you save the report but do not compile it or if you compile the report but do not save
it, then you cannot load the changes into the RDLC report layout in the following step.
You must both save and compile the report.
11. Go to Visual Studio Report Designer. You see the following message: This file has been
modified outside of the source editor. Do you want to reload it? Click Yes or Yes to All to
reload the changes from Classic client Report Designer into the RDLC report layout.
12. In Visual Studio, in the Website Data Sources pane, expand DataSet, right-click Result, and
then click Refresh. The additional items that you added to the dataset in Section Designer in
the Classic client are displayed in the Visual Studio dataset.
13. You can continue making changes in either Visual Studio Report Designer or Classic client
Report Designer without having to close either designer. You must save and compile the report
object after you make changes and load the changes into the report object or the RDLC report
layout when you are prompted.
13
Create .NET Framework applications that can target the RoleTailored client.
See Also
Calling .NET Framework Members from C/AL Code
.NET Framework Type Conversion
Using .NET Framework Arrays
Using .NET Framework Collections
Using .NET Framework Enumerations
Using .NET Framework Generics
Using .NET Framework Interfaces
Calling External Web Services Using Windows Communication Framework
14
Constructors
A constructor is a method that creates an instance of an object and prepares it for use. Before you use a
DotNet variable, you should verify whether the variable is static or is an object instance because this
determines whether you have to use a constructor.
Static variables do not require a constructor because they do not have an instance.
Object instance variables require a constructor because they must be created before they can be
accessed.
To find the constructor and other methods and property for your object, in Object Designer, click Symbol.
You use the same syntax to call static and instance methods.
Calling static methods provides a factory pattern for creating object instances. For example, to create
a new System.TimeZoneInfo object, you call the types System.TimeZoneInfo.Local static method
with the following code:
zone := zone.Local;
A static class or object is loaded once per Microsoft Dynamics NAV Server instance, and the class or
object is shared between all clients that are connected to the server instance. The data that is
maintained by the static class or object is visible by all clients that use the type. You should consider
this in your .NET Framework interoperability design to help avoid disclosing private information.
C# Indexers
A C# indexer is represented as an Item property in C/AL. For example, in C#, the following code sets an
array element N to the value M:
arrayVariable[N] = M;
Indexers can also be overloaded. In Object Designer, click C/AL Symbol Menu to see the parameters
and return types for the indexer.
15
Indexers for lists and arrays that are defined by .NET Framework variables are zero-based, which means
that they start at 0. Other indexers in C/AL start at 1.
If you want to compare two DotNet variables, then you can use the Equals function on the DotNet
variables as shown in the following example:
IF dnVersion1.Equals(dnVersion2) THEN
You can perform comparisons by using .NET Framework methods and properties that return compatible
C/AL types because these objects are implicitly converted to C/AL types before the comparison takes
place. For example, the following C/AL code includes three DotNet variables for the
System.Collections.Generic.List class: dotNetList1, dotNetList2, and dotNetList3. You cannot compare
the DotNet variables directly because they do not return C/AL types. You can perform comparisons on
the List.Capacity property because the List.Capacity property is a NET Framework integer type that
returns a C/AL integer type. For more information about conversion between .NET Framework and C/AL
types, see .NET Framework Type Conversion.
dotNetList1 := dotNetList1.List(5);
dotNetList2 := dotNetList2.List(10);
dotNetList3 := dotNetList3.List(5);
16
17
5. On the Variables tab, in the Name field, type a name for the variable.
6. Set the DataType field to DotNet.
7. In the SubType field, click the AssistEdit button to open the .NET Type List window.
8. In the Assembly field, click the AssistEdit button to open the Assembly List window.
9. If the assembly that you want to reference is in the global assembly cache, then click the .NET
tab. If the assembly is in the Add-ins folder of your Microsoft Dynamics NAV installation, then
click the Dynamics NAV tab.
10. In the list of assemblies, select the assembly, and then click OK to return to the .NET Type List
window.
If you do not see the assembly that you want, then make sure that you have installed it
correctly. For more information, see step 1 of this procedure.
11. In the .NET Type List window, select the type that contains the member that you want to call
from the Microsoft Dynamics NAV object, and then click OK.
The .NET Type List window displays all available types, including classes, enumerations,
structs, and interfaces, which are available in the selected assembly.
By default, variables are set to run the assembly instance on Microsoft Dynamics NAV Server. If
you want to run the assembly instance on the RoleTailored client, see How to: Run a .NET
Framework Assembly on the RoleTailored Client or Server.
18
The arguments variable represents any parameters that you must set for the constructor.
Note
Member names are case-sensitive. Also, constructor names that are longer than 30
characters are truncated after 30 characters.
The MethodPropertyName variable is the name of the method or property that you want to call,
and the arguments variable represents any arguments of the method or property.
Important
Some types in the System namespace of the .NET Framework class library are
automatically converted to C/AL types. You cannot assign values to .NET Framework
variables for these types. For more information, see .NET Framework Type Conversion.
Note
Methods can be overloaded. Therefore see the description at the bottom of the C/AL
Symbol Menu, which shows the parameter and return types for each method. Also,
method and property names that are longer than 30 characters will be truncated, and
you cannot compile the Microsoft Dynamics NAV object. For more information, see
Calling .NET Framework Members From C/AL Code
Example
Description
The following code example uses .NET Framework interoperability to display headlines from an RSS feed
from the Microsoft Dynamics NAV team blog, which has the following URL:
http://feeds.feedburner.com/MicrosoftDynamicsNavTeamBlog?format=xml.
This example calls members of the System.XML assembly, which is part of the Microsoft .NET
Framework class library and is installed in the global assembly cache.
19
To implement this example, you create a codeunit that has the following local variables.
Variable name
DataType
SubType
xml
DotNet
items
DotNet
Integer
title
DotNet
After you create the codeunit, add the following code to its OnRun trigger.
Code
xml := xml.XmlDocument();
xml.Load('http://feeds.feedburner.com/MicrosoftDynamicsNavTeamBlog?format=xml');
items := xml.SelectNodes('/rss/channel/item');
FOR i := 0 TO items.Count - 1 DO
BEGIN
title := items.Item(i).SelectSingleNode('title/text()');
MESSAGE( title.Value );
END
Comments
To see the example in the RoleTailored client, you can create an action on a page that opens the
codeunit.
See Also
Extending Microsoft Dynamics NAV Using Microsoft .NET Framework Interoperability
20
How to: Set .NET Framework Types to Target the RoleTailored Client
or Microsoft Dynamics NAV Server
To extend a Microsoft Dynamics NAV object with .NET Framework interoperability, you define a C/AL
variable that calls members of a .NET Framework type in an assembly. When the variable is called from
the C/AL code of the Microsoft Dynamics NAV object, it creates an instance of the .NET Framework type.
You can set the type instance to target the RoleTailored client or Microsoft Dynamics NAV Server. By
default, an assembly is set to target Microsoft Dynamics NAV Server. However, you can set the type to
target the RoleTailored client.
Important
You cannot set different types of the same variable to target both the RoleTailored client and
Microsoft Dynamics NAV Server.
Set the DotNet variable for the .NET Framework type to target the RoleTailored client.
Copy the .NET Framework assembly to the computer running the RoleTailored client.
Note
You must copy the assembly to each computer running the RoleTailored client. If the
assembly is included in the global assembly cache, then you do not have to do this task.
To set the .NET Framework type to target the RoleTailored client
1. In Object Designer, open the Microsoft Dynamics NAV object that uses .NET Framework
interoperability.
2. Do one of the following steps:
For a local variable, in the C/AL Editor, select the trigger that uses the DotNet variable, and
then on the View menu, click C/AL Locals.
3. On the Variables tab, select the DotNet variable, and then on the View menu, click Properties.
4. In the Properties window, set the RunOnClient property to Yes.
To copy a .NET Framework assembly to a computer running the RoleTailored client
On the computer running the RoleTailored client, copy the.NET Framework assembly to the
Add-ins folder of the RoleTailored client installation.
By default, the path of this folder is C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored
Client\Add-ins.
Note
You can also put assemblies in a subfolder of the Add-ins folder. This can be useful
when you have multiple versions of the same assemblies and dependencies.
21
Setting the .NET Framework Type to Target Microsoft Dynamics NAV Server
To set a .NET Framework type instance to target Microsoft Dynamics NAV Server, you must complete the
following tasks as described in this topic:
Set the variable for the NET Framework type to target Microsoft Dynamics NAV Server.
Copy the .NET Framework assembly to the computer running Microsoft Dynamics NAV Server.
Note
If the assembly is included in the global assembly cache of the computer running Microsoft
Dynamics NAV Server, then you do not have to do this task.
To set the .NET Framework type to target Microsoft Dynamics NAV Server
1. In Object Designer, open the Microsoft Dynamics NAV object that uses .NET Framework
interoperability.
2. Do one of the following steps:
For a local variable, in the C/AL Editor, select the trigger that uses the DotNet variable, and
then on the View menu, click C/AL Locals.
3. On the Variables tab, select the NET Framework variable type, and then on the View menu,
click Properties.
4. In the Properties window, set the RunOnClient property to No.
To copy a .NET Framework assembly to the computer running Microsoft Dynamics NAV Server
On the computer running Microsoft Dynamics NAV Server, copy the .NET Framework assembly
to the Add-ins folder in the Microsoft Dynamics NAV Server installation folder.
By default, the path of the Microsoft Dynamics NAV Server installation folder is C:\Program
Files\Microsoft Dynamics NAV\60\Server\Add-ins.
Note
You can also put assemblies in a subfolder of the Add-ins folder. This can be useful
when you have multiple assemblies and dependencies.
See Also
Calling .NET Framework Members from C/AL Code
How to: Call .NET Framework Members From C/AL Code
22
C/AL type
(range)
(range)
System.Byte
Char
(0..255)
(0..255)
System.SByte
Integer
(-128..127)
(-128..127)
System.Char
Integer
(0..65535)
(2,147,483,647)
System.Int16
Integer
(-32768..32767)
(2,147,483,647)
System.Int32
Integer
(-2,147,483,648..2,147,483,647)
(2,147,483,647)
System.Int64
BigInteger
(-9,223,372,036,854,775,808..
9,223,372,036,854,775,807)
(9,223,372,036,854,775,807)
System.UInt16
Integer
(0..65335)
(2,147,483,647)
System.UInt32
BigInteger
(0..4,250,000,000)
(9,223,372,036,854,775,807)
System.UInt64
Decimal
(0..18,446,744,073,709,551,615)
( 0..
18,446,744,073,709,551,615)
System.Single
Decimal
(3.402823e38)
(3.402823e38)
System.Double
Decimal
(1.79769313486232e308)
(1.79769313486232e308)
Comments
23
C/AL type
(range)
(range)
System.Decimal
Decimal
(79,228,162,514,264,337,593,543,
950,335)
(-999,999,999,999,999.99..
999,999,999,999,999.99)
System.Int32
Option
(2,147,483,647)
(2,147,483,647)
System.Enum
Integer
(-32768..32767)
(2,147,483,647)
System.Bool
Boolean
(TRUE, FALSE)
(TRUE, FALSE)
System.String
Text
(0 to 1024 bytes)
(0 to 1024 bytes)
BigText
Comments
(up to 2 gigabytes)
System.String
Code
(0 to 1024 bytes)
(0 to 1024 bytes.)
System.DateTime
Date
System.DateTime
Time
(00:00:00..23:59:59.999)
System.DateTime
DateTime
(January 1, 1753,
00:00:00.000 to December 31,
9999, 23:59:59.999)
24
C/AL type
(range)
(range)
TimeSpan
Duration
(Resolution is 1 millisecond)
System.Guid
GUID
(128-bit number)
(128-bit number)
System.IO.Stream
InStream
System.IO.Stream
OutStream
Comments
See Also
Extending Microsoft Dynamics NAV Using Microsoft .NET Framework Interoperability
25
Your C/AL code uses .NET Framework interoperability extensively, and you
must share an array among many methods.
Your C/AL code mostly uses basic C/AL types and does not interoperate with
the .NET Framework.
C/AL array
To use a .NET Framework array in C/AL, you must use the System.Array class in the .NET Framework
class library, which is the class from which all arrays inherit. When interfacing with an array in C/AL, you
must use the following methods of the System.Array class to create and access elements in the array.
Method
Description
CreateInstance
SetValue
GetValue
Many .NET Framework classes implement these methods. Therefore, they are available for you to use in
C/AL code. If you are writing your own .NET Framework code and want to use it in Microsoft Dynamics
NAV, then you must implement these methods yourself.
In C/AL, some .NET Framework data types, such as strings, integers, and decimals, are automatically
converted to C/AL types. If a .NET Framework array contains these data types, then you create an
assembly that contains methods that return the information about the data types and then reference the
assembly in the C/AL code. This concept is illustrated in the following examples.
26
2. Build the project, and then copy the assembly to the Add-ins folder of the Microsoft Dynamics NAV
installation folder. By default, the path of the installation folder is C:\Program Files\Microsoft
Dynamics NAV\60\Classic.
3. In the Classic client, open a Microsoft Dynamics NAV object, open the C/AL code, and then create
the following C/AL variables.
Variable
name
DataType
SubType
varDotNet
DotNet
varArray
DotNet
arraySize
Integer
Integer
alData
Integer
4. On a trigger of the Microsoft Dynamics NAV object, add the following C/AL code to create, fill, and
implement the array.
// Sets the number of elements in the .NET Framework array.
arraySize := 10;
// Creates an instance of the .NET Framework array that contains the Int32 type.
varArray := varArray.CreateInstance(varDotNet.GetTypeOfInt32(), arraySize);
// Gets the array data and validates the content. The object that is returned by
// GetValue is automatically converted into a C/AL integer in the assignment.
27
2. Build the project, and then copy the assembly to the Add-ins folder of the Microsoft Dynamics NAV
installation folder. By default, the path of the installation folder is C:\Program Files\Microsoft
Dynamics NAV\60\Classic.
3. In the Classic client, open a Microsoft Dynamics NAV object, open the C/AL code, and then create
the following C/AL variables.
Variable name
DataType
SubType
varDotNet
DotNet
varArray
DotNet
arraySize
Integer
Integer
alData
Integer
4. On a trigger of the Microsoft Dynamics NAV object, add the following C/AL code to create, fill, and
implement the array.
28
See Also
Calling .NET Framework Members from C/AL Code
How to: Call .NET Framework Members From C/AL Code
.NET Framework Type Conversion
29
Example
The following example implements the System.Collections.ArrayList interface and uses the
GetProcesses method from the System.Diagnostics.Process type to display a list of process IDs in
message boxes. Although this is not a typical example for an ERP product such as Microsoft Dynamics
NAV, it shows the flexibility that you get with the .NET Framework.
The example requires that you define the following C/AL variables.
Variable name
DataType
SubType
MyProcessList
DotNet
Process
DotNet
Integer
MyProcessList := Process.GetProcesses();
FOR I:=0 TO (MyProcessList.Length()-1) DO
BEGIN
Process := MyProcessList.GetValue(I);
MESSAGE(FORMAT(Process.Id));
END;
See Also
.NET Framework Type Conversion
How to: Call .NET Framework Members From C/AL Code
30
Example
This example shows how to use an enumeration in integer expressions in C/AL and then convert the text
string back to an integer to store it in the enumeration variable. In the following C# example, the
enumeration is contained in the Microsoft.Dynamics.Nav.EnumSample assembly.
namespace Microsoft.Dynamics.Nav.EnumSample;
{
public class DataTypes
public enum ItemEnum
{
Item1,
Item2,
Item3,
Item4
};
}
}
In the Microsoft Dynamics NAV object, define the following C/AL variables.
Variable name
DataType
SubType
varDotNet
DotNet
'Microsoft.Dynamics.Nav.EnumSample, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=18cff5e0dac2f853'.
Microsoft.Dynamics.Nav.EnumSample.DataTypes.ItemEnum
formatResult
Text
alInteger
Integer
Length
30
To handle the enumerator type, add the following code to a C/AL function.
// Assign an integer to the .NET Framework enumeration.
// This assigns Item3 because enum values are zero-based.
varDotNet := 2;
31
error('Wrong enumeration value. Expected %1, but actual was %2.', 'Item3', formatResult);
// Assuming that the enum value is stored as a text string, convert it back to the
// proper enum value.
varDotNet := varDotNet.Parse(varDotNet.GetType(), 'Item4');
// The varDotNet enum should now contain the integer value 3 and the enum 'Item4'.
alInteger := varDotNet;
if alInteger <> 3 then
error('Wrong enumeration integer value. Expected %1, but actual was %2.', 3, alInteger);
formatResult := format(varDotNet);
if formatResult <> 'Item4' then
error('Wrong enumeration value. Expected %1, actual was %2.', 'Item4', formatResult);
See Also
Calling .NET Framework Members from C/AL Code
How to: Call .NET Framework Members From C/AL Code
.NET Framework Type Conversion
32
If a method returns an instance of a generic whose type name is defined, then the type name is applied.
In the following example, the method returns a List<String> instance, and mylist is instantiated as a
List<String> type.
mylist := x.GetAStringList();
Example
The following example constructs a string list, fills the list with data, and then uses the Item method to
validate whether the list contains the expected data. The Item method is equivalent to a C# index
operator.
Variable
Data Type
SubType
DotNet
Length
name
varDotNet
PublicKeyToken=b77a5c561934e089'.System.Collections.Generic.
List`1
textResult
Text
Integer
capacity
Integer
30
capacity := 5;
varDotNet := varDotNet.List(capacity);
FOR i:= 0 TO (capacity-1) DO
varDotNet.Add(FORMAT(i));
IF varDotNet.Count <> capacity THEN
ERROR('Wrong list count, expected {0}, actual {1}', capacity,
varDotNet.Count);
FOR i:= 0 TO (capacity-1) DO
BEGIN
DEVELOPER UPDATES FOR MICROSOFT DYNAMICS NAV 2009 R2
33
textResult := varDotNet.Item(i);
IF textResult <> FORMAT(i) THEN
ERROR('List index [%1] contains the wrong data, expected %2, actual
%3', i, FORMAT(i), textResult);
END;
See Also
Calling .NET Framework Members from C/AL Code
How to: Call .NET Framework Members From C/AL Code
34
Example
In the following C# example, you have the Sample class that explicitly implements the ISample interface.
class Sample : ISample
{
...
string ISample.Name()
{
...
}
}
To call the ISample.Name method from C/AL code, you create the following variables.
Variable name
DataType
SubType (simplified)
cvar
DotNet
Sample
ivar
DotNet
ISample
After you create the variables, add the following code that assigns the class variable to the interface
variable and then calls the interfaces method.
// Assigns the class variable to the interface variable.
ivar := cvar;
...
35
Example
The following code example uses a proxy web service class and calls a Read method from the Microsoft
Dynamics NAV web service. To set up this example, you expose page 42 as a web service in the Web
Service table and then generate and compile the proxy class. For more information, see Working with
Web Services in the MSDN Library.
The example requires the following variables.
Variable name
DataType
SubType
Length
navBinding
DotNet
address
text
salesOrderService
DotNet
endpointAddress
DotNet
salesOrder
DotNet
256
navBinding := navBinding.BasicHttpBinding;
36
See Also
Calling .NET Framework Members from C/AL Code
How to: Call .NET Framework Members From C/AL Code
37
You typically use a FactBox to display information that is related to an item on the main content page. For
example, on a page that shows a sales order list, you can use a FactBox to show customer details for a
selected sales order in the list.
A FactBox is divided into one or more parts that are arranged vertically. Each part can contain one of the
following objects:
Chart.
Using the wizard, you can add a FactBox on the following page types:
Card
Document
38
List
ListPlus
Navigate
Worksheet
Note
If you want to add a FactBox without using the wizard, see Walkthrough: Adding a FactBox to the
Customer List Page in the MSDN Library.
To add a FactBox to a page using the wizard
1. In the Classic client, on the Tools menu, click Object Designer.
2. In Object Designer, click Page, and then click New.
3. In the New Page dialog box, click Create page using wizard, and then select one of the
following page types from the list:
Card
Document
List
ListPlus
Navigate
Worksheet
4. To associate a table with the page, in the Table text box, click the AssistButton, select a table,
and then click OK.
5. Click OK to go to the next step in the wizard.
6. Continue the wizard until you get to the step that asks you about which FactBoxes to include on
the page.
7. Depending on what part you want to add, click either the Page, System, or Chart tab.
8. Select the part from the list, and then click the > arrow to add it to the Part Order list on the
right.
9. Repeat steps 7 and 8 to add more parts.
The parts vertical position in the Part Order list determines its vertical position in the FactBox
on the page.
10. To remove a part, click the Page, System, or Chart tab based on the part type, select the part
from the Part Order list, and then click the < arrow.
11. Finish the steps in the wizard.
For more information about the wizard and creating pages, see How to: Create a Page in the
MSDN Library.
39
If you are in configuration mode, then the system indicator is automatically displayed, and you cannot
turn it off.
If you are in any other mode, then you must first set up the system indicator in the Company
Information window. It is then shown according to your preferences on every page.
To enable the system indicator
1. In the RoleTailored client, in the navigation pane, click Departments, click Administration,
click General, and then click Company Information.
2. Expand the System Indicator FastTab.
3. In the System Indicator field, select one of the following options.
System indicator type
Description
None
No text is shown.
Note
When you are in configuration mode, the
Configuration status is always displayed. You
cannot turn this text off.
Custom Text
Shows text that you enter in the System Indicator Text field.
Company Information
Company
Database
Company+Database
Shows the company name, the middle-tier host name, and the
database name.
4. In the System Indicator Style field, select from the Standard and Accent1 through Accent9
options to add a certain style to the system indicator.
5. In the System Indicator Text field, enter custom text to show. To show the text, you must
select the Custom Text option in the System Indicator field.
6. Click OK, and then exit and open the RoleTailored client to see the changes.
40
Microsoft Dynamics is a line of integrated, adaptable business management solutions that enables you and
your people to make business decisions with greater confidence. Microsoft Dynamics works like and with
familiar Microsoft software, automating and streamlining financial, customer relationship, and supply chain
processes in a way that helps you drive business success.
U.S. and Canada Toll Free (888) 477-7989
Worldwide (1) (701) 281-6500
www.microsoft.com/dynamics
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed
as of the date of publication. Because Microsoft must respond to changing market conditions, this document should not be
interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information
presented after the date of publication.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no
part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by
any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express
written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering
subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the
furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual
property.
2010 Microsoft. All rights reserved.