Search This Blog

Format Amount in Indian Style on Navision - RDLC

Unlike the Arab styling of numbers which places a comma on each thousand (1000’s), the Indian way of styling numbers is different and is used only by India, Nepal, Pakistan, Bangladesh and Sri Lanka.
Currently, NAV does not support the Indian Numbering Style on Reports or must I say that RDLC doesn’t have any provision.
The following piece of code enables you to format Amounts in Indian Style of Numbering.
______________________________________________________________________
Variables
NameDataTypeSubtypeLength
AmtInTextText50
DecPlacesText3
StopBoolean
DummyAmtDecimal
DummAmtInTextText50
iInteger
DivByInteger
_____________________________________________________________________
Code
DecPlaces := ‘.00’;
AmtInText := FORMAT(Amt);
AmtInText := DELCHR(AmtInText,’=’,’,’);
IF STRPOS(AmtInText,’.’) 0 THEN BEGIN
   AmtInText := COPYSTR(AmtInText,1,STRPOS(AmtInText,’.’)-1);
   DecPlaces := COPYSTR(AmtInText,STRPOS(AmtInText,’.’),STRLEN(AmtInText));
END;

RetAmtVal := FORMAT(Amt);
RetAmtVal := DELCHR(RetAmtVal,’=’,’,’);
i := 1;
DivBy := 1000;
REPEAT
   CLEAR(DummAmtInText);
   CLEAR(DummyAmt);
   IF i = 1 THEN BEGIN
      DummyAmt := Amt/DivBy;
       i +=1;
   END ELSE BEGIN
      DivBy := DivBy * 100;
      DummyAmt := Amt/DivBy;
      i +=1;
   END;
   IF DummyAmt < 1 THEN
      Stop := TRUE
   ELSE BEGIN
      DummAmtInText := FORMAT(DummyAmt);
      DummAmtInText := DELCHR(DummAmtInText,’=’,’,’);
      IF STRPOS(DummAmtInText,’.’) 0 THEN
         DummAmtInText := COPYSTR(DummAmtInText,1,STRPOS(DummAmtInText,’.’)-1);
      RetAmtVal := INSSTR(RetAmtVal,’,’,STRLEN(DummAmtInText) + 1);
   END;
UNTIL Stop;
RetAmtVal := RetAmtVal + DecPlaces;

Resolved - Post GST Reconciliation Bug in Dynamics NAV IN Build 9.00.48466

This bug came to us when we posted an GST settlement entry and our General Ledger Setup was deleted.

Yes, that`s really a big problem as General Ledger Setup is the most important part of Navision.

We tried to debug the process & find the code but was not getting anywhere.

But just as we were about to give up, we noticed that there was a field in Table ID - 16433 (GST Reconciliation) -  "GST Recon. Tolerance" in which if a value is validated then only General Ledger Setup was getting deleted.

We checked the code on the - OnValidate() Trigger of the field on the table given below is what we found -


Solution : Remove the code from OnValidate() Trigger of field "GST Recon. Tolerance" from Table ID - 16433 (GST Reconciliation).



How to create NAV Instances with multiple builds in the same machine for the same Navision Version (Through PowerShell)

The concepts described in this post are applicable to different versions/builds, for examples I will use an installation of Microsoft Dynamics Navision 2016 (9.00.50458) AU version and I will create one more instances also for the Microsoft Dynamics Navision 2016 (9.00.48466) IN version on the same machine.

Prerequisites:
  • Microsoft Dynamics Navision 2016 (9.00.50458) AU version should be installed on the machine as the base version.
  • Microsoft Dynamics Navision 2016 (9.00.48466) IN version setup downloaded from Microsoft Partner Source website.

Solution :

After you installed Navision 2016 (9.00.50458) AU version it`s Service files will be inside the following path:

C:\Program Files\Microsoft Dynamics NAV\90\  (As shown below)




Step - 1 : Copy the folder 90 in a new folder 90 – 48466 (As shown below)




Step - 2 : Copy all files from the Service folder, Which you will find in the Microsoft Dynamics Navision 2016 (9.00.48466) IN version setup folder (As shown below)

NAV.9.0.48466.IN CU 19.DVD\ServiceTier\program files\Microsoft Dynamics NAV\90\Service



Step -3 : Replace All the copied files into the Service folder on the given below path : (As shown below)

C:\Program Files\Microsoft Dynamics NAV\90 - 48466\Service

Note : Do not replace the files inside the base folder which was installed with setup.




Step – 4 : Open Windows PowerShell ISE (Run as Administrator) (As shown below)



Step - 5 : Run PowerShell command : (As shown below)

Set-ExecutionPolicy RemoteSigned

We will be running the script and by default, PowerShell stops running scripts. Run above command to set Execution Policy to Remote Signed.

Click on - Yes to ALL 



Step - 6 : Execute the following PowerShell CmdLet : (As shown below)

New-Service 'MicrosoftDynamicsNAVServer$Demo48466' -BinaryPathName '"C:\Program Files\Microsoft Dynamics NAV\90 - 48466\Service\Microsoft.Dynamics.Nav.Server.exe" $Demo48466 /config "C:\Program Files\Microsoft Dynamics NAV\90 - 48466\Service\Microsoft.Dynamics.NAV.Server.exe.config"' -DependsOn 'HTTP' -Description 'Service handling requests to Microsoft Dynamics NAV application.' -DisplayName 'Microsoft Dynamics NAV Server [Demo48466]' -StartupType Manual 

Note: you can replace Demo48466 with your preferred name 


As you can see in the given below image a new Service Instance has been created on Dynamics NAV 2016 Administration under the login account as SYSTEM.

Now all you have to do is just configure the Database Server, Database Instance & Database Name into Service Instance Configuration option.

Note : You may need to change the Ports of the  manually created Server Instance as it may conflict with other Service Instances already created on the machine.


*****In case of any error during the process, to delete/remove the created service use the following PowerShell CmdLet :

sc.exe delete 'MicrosoftDynamicsNAVServer$Demo48466' 

Note: don’t remove the instance using Microsoft Dynamics NAV 2016 Administration because, this is the Default instance for this build and it will removed the Service folder from the 90 - 48466 folder.


Hope you will find this post useful...
If any queries comment below.. 

STEP 3 - MSDYN365BC (Setup) - How to Setup Business Central

In the last articles in Step 1 & Step 2 of MSDYN365BC setup we installed dockers & Visual Studio Code for windows.
Next step is to download the Business Central Image using dockers and in future articles, we will start hacking or customizing Business Central.

If you are new to this series you can read old articles referring label MSDYN365BC.

Setup Business Central

Search and open Windows Powershell ISE as administrator.
Run command docker version to confirm that docker is installed and running.
If it's installed and running you will see an output as in below screenshot. If not then run the docker from the desktop shortcut or from the start menu.
Run command docker pull microsoft/bcsandbox:us to download the image for Business Central US version.
** This command running for the first time will take some time to download, don’t run it on a weak internet connection.
Using an object-oriented programming analogy, the difference between a Docker image and a Docker container is the same as that of the difference between a class and an object. An object is the runtime instance of a class. Similarly, a container is the runtime instance of an image.

Run PowerShell command –
Set-ExecutionPolicy RemoteSigned
We will be running the script and by default, PowerShell stops running scripts. Run above command to set Execution Policy to Remote Signed.
install-module navcontainerhelper -force
navcontainerhelper is a PowerShell Module, which can be installed from the PowerShell Gallery by using above cmdlet.
docker images
Above command will list down all the images that you have downloaded till now. If you have already run download image in the last section you should see one image as shown below.

docker container ls
Above command will list down all the containers which are running right now. As we don’t have any containers it will return blank.
New-NavContainer
For above command, please run using right-hand command panel and specify following parameters as per requirement.
A Sample command for New-NAVContainer is below –
           
New-NavContainer -containerName sauravMSDYNBC -accept_eula -alwaysPull -assignPremiumPlan -auth NavUserPassword -doNotExportObjectsToText -enableSymbolLoading -imageName microsoft/bcsandbox:us -includeCSide -memoryLimit 3G -shortcutsDesktop -updateHosts

Once you run above command, the system will prompt you to save your username & Password as encrypted.
** Remember your password.
** Password should fulfill password policy for SQL Server.

Once­ the PowerShell command is complete, a screen like below as result of PowerShell cmdlet.
Please keep a note of from above screen –
** These values will be used for using this container.
1      Container IP Address
2        Container Hostname
3        Container Dns Name
4        Web Client
5        Dev. Server
6        Dev. ServerInstance
7        Files

Check your desktop, you should have all shortcut icons that are require accessing Business Central Container.
Go ahead and use any of these + if you have SQL Server management studio installed, you can connect to SQL for Docker database.

** Remember as docker will start all containers will start automatically. Please remember to use docker container stop cmdlet to save the memory of your host machine.

If you are interested to load some old NAV version using docker you can refer following GitHub page.

Business Central (Github) : https://hub.docker.com/r/microsoft/bcsandbox/
Dynamics NAV    (Github) : https://hub.docker.com/r/microsoft/dynamics-nav/

Be Ready, with the setup of business central on your local system. we will be discussing AL Code and how we can customize Business Central.


Source : https://saurav-nav.blogspot.com/2018/06/msdyn365bc-setup-business-central.html

STEP 2 - MSDYN365BC (Setup) - How to Install Visual Studio Code

In the last article Step 1 of MSDYN365BC setup, we installed dockers for windows. Most of us know that for coding in Business Central on cloud version we will require to use Visual Studio Code.

We all know that is future, I will leave it to you if you plan to ignore it but that is a clear Roadmap for the product in future. Even Business Central on-prem will allow customizing using NAV Developer environment I think its time we change our mindset and start using Visual studio Code.

In this article, we will discuss installation of Visual Studio code that we will use in future articles to customize business central.


What is Visual Studio Code?

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux, and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.


Is Visual Studio Code is a replacement of C/AL?

No, it's not the way we code in NAV from ages will remain as it is in VS code. I would even say that coding in VS Code will make life more simple with new features that are available.

Yes, it will change the way we used to code. It will not allow us to modify any base objects in any way. You can only see the Metadata of standard object but you cannot modify it.


How it will impact?

It will be hard as everyone of us will have to unlearn old way of customizing NAV and will need to learn the new way of doing things which is using events and subscriptions?

Event and subscriptions are available from NAV 2016 and have enhanced in last 3 version.


We heard a lot about extensions. Do we need to worry about it?

If you have used extension V1 which is in NAV 2016 you might have the bad experience with them. Forget all those experiences and see the new V2 Extension which is completely automated.

If you haven't used extensions (as developers) you don't need to worry about it. Its all automated.  If you want to focus/learn then spent your time and energy on Events and subscriptions.

Installation of Visual Studio Code- 

Visit - https://code.visualstudio.com/Download

Download the installer from the website, based on your operating system.

Double-click VSCodeSetup Installer to run the installer.

I would suggest - During Installation setup actions for windows (all) as shown below.


Ready to Hack Business Central on Dockers. Just one more configuration that we will discuss in next article and then we will talk business.


STEP 1 - MSDYN365BC (Setup) - How to Install Dockers

The first article in this series is about the installation of dockers for windows. I know there may be some questions about dockers and why a new technology or software with all these changes in Product.

I will try to answer most of these questions and we will also talk about installation of Dockers.


What is Dockers?

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.

Read More about dockers here -  Link - https://www.docker.com/what-docker

Is Docker is a Microsoft Product?

Docker is not a Microsoft product. It's an open source software. In October 2014, Microsoft announced the integration of the Docker engine into the next Windows Server release. Windows Containers was made available for Windows 10 and Windows Server 2016.

Why we need to install Docker?

Freedy from Microsoft has put great efforts in integrating NAV and MSDYN365BC with Dockers.

With respect to NAV, dockers can be used for the following version -
1. NAV 2016.
2. NAV 2017.
3. NAV 2018.

All cumulative updates released by Microsoft on following versions are also available on dockers.

Business Central (latest and greatest) releases is also available in dockers.

More Resources by Freedy - https://blogs.msdn.microsoft.com/freddyk/tag/nav-on-docker/

You can plan to use or not to use dockers but I personally feel it will be a cool tool in your toolbox to have multiple version and CU in one single environment which can be accessed turn on and off based on your requirements. I will be using dockers to configure and demo Business central.

Docker Installation - 

Navigate to https://store.docker.com/editions/community/docker-ce-desktop-windows

Download the installer from the website.


Double-click Docker for Windows Installer to run the installer.

In the configuration panel, please select “Use Windows containers instead of Linux containers.”


Installation completed confirmation message.



When the installation finishes, run docker from the desktop (if you selected Add shortcut to desktop).

The whale icon in the notification area indicates that Docker is running, and accessible from a terminal.

Be Ready with Dockers, we will be using in future articles. We have one more installation to be done to continue our journey towards Microsoft Dynamics 365 Business central. We will talk about it in future articles.


Source : https://saurav-nav.blogspot.com/2018/06/msdyn365bc-install-dockers.html

How to run a Table from the Navision windows client (Not the Development Environment)

Here is a small tip (some of you might already know it): the GETURL together with the HYPERLINK can be used to run objects in Navision (Even Tables 🙂).

I am working on a tool for a function to view the data in the tables, and for this I needed a way to run a table from the Navision windows client (Not the Development Environment). This turned out to be quite easy using the GETURL and HYPERLINK functions.

Here is an example of how it can be applied;

Given below record will consist of a list of tables where a user can check Records for the tables where all data is counted. To assist the user in determining what exactly is the data in a particular record we created a function to run the table to show the data will be in the ribbon of the page. The function will run the table of the line that is highlighted based on the Table ID field.

The code for this is as follows.
The GETURL is used to build the link to the table and the HYPERLINK is used to open the link.


Now when the user clicks View Records Dynamics NAV will open the table and show all records just like if the table was run from the Object Designer (Development Environment)

Nice isn’t it!? 🙂