Monday, January 12, 2015

How to enable configuration mode in Dynamics NAV 2015

Hi all,

This post will help to configure dynamics NAV 2015 user interface for particular user profile.

It will enable admin or super user to configure the UI.

Here is steps to enable configuration mode.

1. In Dynamics NAV 2015 Navigate the profile list.

<Company Name> /Departments/Administration/Application Setup/RoleTailored Client/Profiles

2. Select a profile that you would like to use as a template. Ex : ("ORDER PROCESSOR").

3. In the action ribbon select the copy profile and make duplicate of a Profile . Ex: ("ORDER PRO CASH").

4.

once the profile created, go to the
     " C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client "
and find the RTC client exe and make a desktop shortcut for make the process easy.

5. In the desktop you can find the Dynamics NAV icon and go to properties of the icon.

Modify the target as

"     "C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe" -configure -profile:"ORDER PRO CASH"       "

6. Click apply and run the Dynamics NAV from that icon. Then Dynamics NAV will open as configuration mode.



7. Then you can make any changes in the UI and that will effected to the particular profile accordingly.


Thank you.

Regards,
Dinuka.

Tuesday, January 6, 2015

Difference between CREATEDATETIME( DATE,TIME) and CURRENTDATETIME


It is requirement for me to insert date and time in  the data table.

In NAV , I have found that there are two functions that provide the output of datetime.

Ex:  (1.) Datetime := CREATEDATETIME( DATE,TIME);

        (2.) Datetime := CURRENTDATETIME;


The only difference I have found is that function (1) have facility to send parameters of date and time in separate way while function (2) directly provide current date and time in once.

It is a small issue that we had that what is best function to use with. But I think its up to developer to choose best method which is suit for the situation.

Thank you.

Regards,
Dinuka.


Microsoft Dynamics NAV Numeric function.


POWER Function (NUMBERS)
  
This is a default function given in CAL that raises a number to a power.

Ex:   NewNumber  :=  POWER(Base,Power);

      POWER(2,8)  => 256
      POWER(100,0) => 1

ROUND Function (NUMBERS)

Rounds the value of Numeric Variables.

Ex:    NewNumber :=  ROUND(Number,[..Precision],[..Direction])

DecimalToRound := 1234.56789;
Precision := 0.001;
Direction := '>';

Result := ROUND( DecimalToRound,Precision ,Direction ) ;

MESSAGE(ROUND(%1 ,%2 ,%3 ) returns %4 ,DecimalToRound,Precision,Direction,Result );

The message will shown like this.

"ROUND(1,234.56789, 0.001, >) returns 1,234.568"

The following table will show some additional ROUND examples.


Number
Precision
Direction
Rounded number
1234.56789
  100
=
1200
1234.56789
  0.1
=
1234.6
1234.56789
  0.001
=
1234.568
1234.56789
  0.001
1234.567
1234.56789
  0.001
1234.568
-1234.56789
  100
=
-1200
-1234.56789
  0.1
=
-1234.6
-1234.56789
  0.001
=
-1234.568
-1234.56789
  0.001
-1234.567
-1234.56789
  0.001
-1234.568



 When you round down ('<') a negative number, the following occurs: -1234.56789 is rounded down to -1234.567. However, -1234.567 is a mathematically greater value than -1234.56789.

      When you round up ('>') a negative number, the following occurs: -1234.56789 is rounded up to -1234.568. However, -1234.568 is a mathematically smaller value than -1234.56789.


ABS Function (NUMBER)

Calculate the absolute value of a number  (Decimal, Integer or Bigint) . This function also returns of
positive and zero values only.

Ex:   NewNumber := ABS(Number);

x := -10.32;
y := ABS(x);

MESSAGE('x is  %1  y is  %2');

The message will show "x is -10.32 y is 10.32".


EVALUATE Function (NUMBER)

Evaluates a string representation of a value into its normal representation. The result  is  assign to a variable.


Ex :  [..ok] := EVALUATE(Variable,String[,Number]);

Text000     'VarInteger = #1###### , and the return code is %2\'

Text001     'VarDate = #3###### , and the return code is %4\'

Text002     'VarYesNo = #5###### , and the return code is %6\'

Value :=  '010196';

Ok1 :=  EVALUATE (VarInteger,Value);

Ok2 :=  EVALUATE (VarDate,Value);

Ok1 :=  EVALUATE (VarYesNo,Value);

MESSAGE (Text000 + Text001 + Text002 , VarInteger, Ok1, VarDate, Ok2 , VarYesNo, Ok3);

The message will show you.
"
VarInteger = 10196 , and the return code is: Yes
VarDate = 01/01/96, and the return code is: Yes
VarYesNo = No , and the return code is: No  "

Thank you.

Regards,
Dinuka.







Monday, January 5, 2015

FORMAT Function (Code, Text)

Most of the time, we are using the function "FORMAT()" to convert values into string.

String := FORMAT(Value[, Length][, FormatStr/FormatNumber])

Parameters

Value
Type: Any
This is a C/AL variable (expression) of any simple data type, such as option, integer, biginteger, decimal, char, text, code, date, time, datetime, Boolean, binary, or GUID.
If, when the system formats Value, the result is a value larger than the maximum length MAXSTRLEN Function (Code, Text) of String, a run-time error occurs.
Length
Type: Integer
This optional parameter specifies the length of String. The following rules apply:
  • If Length = 0 then the entire value is returned (default).
  • If Length > 0 then the returned string will be exactly Length characters.
    If Value is less than Length characters, then either leading or trailing spaces are inserted, depending on the format that you select.
    If Value exceeds Length characters, then String is truncated to Length characters.
  • If Length < 0 then the returned string will not have leading or trailing spaces.
    If Value is less than Length characters, the length of String will equal the length of Value.
    If Value exceeds Length characters, then String is truncated to Length characters.
FormatStr
Type: String
A literal string that defines a format as in the Format Property.
For an example if we need,
Value (Decimal) := 22; Result (Text)
This will return on 22.
but think if we need to get the output like "22.00" ?
by using FORMAT() function is much easy.
Result := format(Value,0,'<Integer><Decimals,3>'); -> 22,00
Thank you.

Regaerds,
Dinuka.

How to install RTC in client machine in Dynamics Navision 2015


This article will guide you , how to install dynamics NAV 2015 RTC  in the client machine.

H.W Requirements:  

Processor : Hard disk space: 500 MB.

Operating System (only 64-bit editions supported): Windows 7, Windows 8, Windows 
Server 2008 R2, or Windows Server 2012. .

  •      Microsoft .NET Framework 4.5.

Microsoft Dynamics NAV 2015 Setup installs this software if it is not already present 
on the target computer.

  •      Internet Information Server 7.0 or Internet Information Server 8.0. The following features 

must be enabled:

  •       .NET Extensibility in IIS 7.0 or .NET Extensibility 4.5 in IIS 8.0
  •       ASP .NET in IIS 7.0 or ASP .NET 4.5 in IIS 8.
H.W Requirements:  

Processor : Hard disk space: 500 MB.

Operating System (only 64-bit editions supported): Windows 7, Windows 8, Windows 
Server 2008 R2, or Windows Server 2012. .

  •      Microsoft .NET Framework 4.5.

Microsoft Dynamics NAV 2015 Setup installs this software if it is not already present 
on the target computer.

  •      Internet Information Server 7.0 or Internet Information Server 8.0. The following features 

must be enabled:

  •       .NET Extensibility in IIS 7.0 or .NET Extensibility 4.5 in IIS 8.0
  •       ASP .NET in IIS 7.0 or ASP .NET 4.5 in IIS 8.0

Additional software :

Microsoft .NET Framework 4.5.

Microsoft Dynamics NAV 2015 Setup installs this software if it is not already present 
on the target computer.
  •  Windows PowerShell 3.0. For other supported operating systems, see Windows 
Management Framework 3.0 on the Microsoft Download Center.
  • Microsoft Report Viewer 2012 is required for Save as Excel or Save as PDF functionality. 
Microsoft Dynamics NAV 2015 Setup installs this software if it is not already present on the target computer.

Step-by-step procedure to install Dynamics NAV 2015.

Run Dynamics NAV 2015 setup.



Here comes the welcome screen .

Just click "Next" to process the installation.


Now, you can see the Microsoft Software License Terms and you can read for get information about
Product software license.

Once, you finished reading, click "I accept" to process further.





As I installing the Dynamics NAV server, I selected "Choose an installation option". Which Dynamics NAV provide facility to select the options which elements to install.



In above window, I am going to select "Custom" because I need to  install all  different elements.




Select "Run all from My Computer" in order to install all elements. Now, select "Next" to configure
the Dynamics NAV server.



 In the "Specify parameters" we can setup the NAV server configuration by providing the Server name , database name , service ports and many more.



 In the SQL server Database components, we can assign SQL server name and the SQL server instant and the database name. 



Finally , we can install Microsoft Dynamics NAV 2015 with all configurations.

Thank you.
Reagrds,
Dinuka.





Sunday, January 4, 2015

Error : You do not have access to Microsoft Dynamics NAV.


Hi all,

In dynamics NAV , you might have faced a problem with log in to NAV RTC.

The error is 



Mainly, this error will occur because of the user permissions. 

For my experience, when we create a user in dynamics NAV, the system will not allow other users to 
login and will appear above error.

To avoid this issue we can manually delete the users from MS SQL and retry to login the NAV.


USE [YourNAVDatabase];  
 delete FROM [dbo].[Access Control];  
 delete FROM [dbo].[User];  
 delete FROM [dbo].[User Property];  
 delete from dbo.[User Personalization];  
 delete from dbo.[User Metadata];  
 delete from dbo.[Page Data Personalization]; 





Restart the NAV service and try to login to the Dynamics NAV.




Thank you.

Regards,

Dinuka

DECSTR (like INCSTR but decreasing)

Hi all,

This post is about a function that we can create the opposite of INCSTR .
In dynamics NAV "INCSTR" is used for Increases a positive number or decrease a negative number inside a string by one (1).

Ref. http://msdn.microsoft.com/en-us/library/dd338972.aspx

For example : 
NewString := INCSTR(String)

Parameters

String
Type: Text constant or code
The string that you want to increase or decrease.

Property Value/Return Value

Type: Text constant or code
The result after increasing or decreasing String.
 
 However, we can developed a function which will provide the opposite of INCSTR. For some cases we need to used it.

 Here is the function code.
A function to descrease a string:

DecStr(IcodIncoming : Code[20];IintStep : Integer) OcodReturnCode : Code[20]
// DecStr //> 104
// Like the NAVISION INCSTR-function but DECREASING
// PARAMETERS:
// IcodIncoming : String to be decreased (if this string does not contain a number, an empty string is returned)
// IintStep : Decrement with this value (if it is negative, an empty string will be returned)
// (if it is 0, the value of "IcodIncoming" will be returned)
// RETURN-VALUE : decreased string

// in some cases, just exit
IF IintStep = 0 THEN
EXIT(IcodIncoming);
IF IintStep < 0 THEN
EXIT('');
IF IcodIncoming = '' THEN
EXIT('');

LcodAllowedChars := '1234567890';
LintLen := STRLEN(IcodIncoming);
LintStartOfNumericPart := LintLen;

// search the last not numeric character
WHILE (STRPOS(LcodAllowedChars,COPYSTR(IcodIncoming,LintStartOfNumericPart,1)) <> 0) DO
LintStartOfNumericPart -= 1;

// start of numeric part
LintStartOfNumericPart += 1;

IF LintStartOfNumericPart > LintLen THEN
EXIT(''); // no numeric part found at right end of the string

EVALUATE(Lint,COPYSTR(IcodIncoming,LintStartOfNumericPart));

Lint -= IintStep;

IF Lint < 0 THEN
ERROR(LtxcNegative,IcodIncoming,IintStep,Lint);

LcodAllowedChars := FORMAT(Lint);

OcodReturnCode :=
COPYSTR(IcodIncoming,1,LintStartOfNumericPart - 1) +
PADSTR('',LintLen - LintStartOfNumericPart - STRLEN(LcodAllowedChars) + 1,'0') +
LcodAllowedChars;

Thank you
Regards,
Dinuka.