Showing posts with label NAV 2009. Show all posts
Showing posts with label NAV 2009. Show all posts

Wednesday, 5 October 2016

Defining Automation Variables - Problem - Navision 2009 R2

Hello Everyone,

I was working with one of our clients for requirement that uses Automation Variable in Navision 2009 R2.

I had observed a very strange behavior while defining an Automation Variable.

I got the error shown in below snapshot while I was defining Automation Variable.


Automation


I found the solution for this very strange thing.

Solution Details
1 - For using Automation variable, we must upload developer license in database. Then we    can define the Automation variable datatype and use that.

2 - Even if we change the license to developer license then also it won’t work. We must upload the developer license.

Note – Navision would not give any compilation error if we define Automation variable using developer license and then upload back client license again and compile objects.


Hope this helps.

Your valuable comments and feedback are appreciated.

Wednesday, 24 August 2016

Dll register and Unregister - Automation Variables - Navision 2009 R2

Hello Everyone,

I was working on one of the requirement form client regarding FTP in Navision 2009 R2 using Automation variables.

DLL Folder Location



General Approach – To register a dll - Using cmd

1 – Run cmd as administrator
2 – Go to main C: by using command – cd\
3 – Go to Folder FTPFileManagementWithSSL where your dll is located using command - cd FTPFileManagementWithSSL
4 – Execute Command - tlbexp FTPFileManagementWithSSL.dll /out: FTPFileManagementWithSSL.tlb
5 – Execute Command - "C:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm" /tlb: FTPFileManagementWithSSL.tlb FTPFileManagementWithSSL.dll
6 – Execute Command - "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil" /i FTPFileManagementWithSSL.dll

Dll Registered successfully – Only in those cases where Microsoft SDKs are installed.

But even using above approach I was getting error – “Automation Control was not registered Successfully” when I used Automation variable in code.

Error

---------------------------
Microsoft Dynamics NAV Classic
---------------------------
This message is for C/AL programmers:

Could not create an instance of the OLE control or Automation server identified by
GUID={6B57267D-A9B1-4C21-9360-E350B57C71AF} 2.0:{D70659DB-C298-3D6B-98BC-C369261DD352}:'FTPFileManagementWithSSL'.FTPFileManagementWithSSL.
Check that the OLE control or Automation server is correctly installed and registered.

---------------------------
OK  
---------------------------

Newer Approach – To register a dll - Using cmd and PowerShell – Windows server 2012

1 – Run cmd as administrator
2 – Go to main C: by using command – cd\
3 – Go to Folder FTPFileManagementWithSSL where your dll is located using command - cd FTPFileManagementWithSSL
4 – Execute Command - tlbexp FTPFileManagementWithSSL.dll /out: FTPFileManagementWithSSL.tlb
5 – Run Windows PowerShell as Administrator
6 – Execute Below Command – For Regasm
."C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" -codebase -tlb "C:\FTPFileManagementWithSSL\FTPFileManagementWithSSL.dll"

7 – Execute Below Command – For gacutil
Set-location "c:\FTPFileManagementWithSSL"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("c:\FTPFileManagementWithSSL\FTPFileManagementWithSSL.dll")
iisreset

Dll Registered successfully. And When I ran my code using Automation Variable my error got resolved.

Assembly


Also if we want to unregister dll from Gac execute below command,
Set-location "c:\FTPFileManagementWithSSL"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("c:\FTPFileManagementWithSSL\FTPFileManagementWithSSL.dll")
iisreset


Hope this helps.

Friday, 1 July 2016

Pad Char - In RDLC Report

Hello Everyone,

I was upgrading report from Nav 2009 R2 to Nav 2016. I found an interesting feature that I did in RDLC in correspondence to section property.

For one of the text box in Nav 2009 R2 I saw that a Pad Char property set to * as shown in snapshot 1. There is no such property in RDLC.

So I found a way to do this.


Snapshot 1 - Nav 2009 R2 - Section

Check

Snapshot 2 - Nav 2016 – RDLC – Code

RDLC

Code

Public Function MyPaddedString(ByVal Value As String)
    Return Value.PadLeft(27,"*")
End Function

Function Call

Function Call














Code
=Code.MyPaddedString(Choose(25,Split(Cstr(ReportItems!CompanyAddresses.Value),Chr(177))))

Snapshot 3 - Output – Nav 2009 R2

Check

Snapshot 4 - Output – Nav 2016

Check

And its done.

So similarly it can be done for Padding Right also.

Hope this thing some time helps in upgrading reports.


Your valuable comments and feedback are appreciated.

"Power is gained by Sharing Knowledge not hoarding it"

Friday, 24 June 2016

NAV 2009 R2 and Lower - Save Export to Excel - At a specific Location

Hello Everyone,

If we want to Export Data to Excel and Save that file at a particular location, here is one of the simplest way to do it.

We all know the famous blog of Saurav Dhyani“NAV 2013 & NAV 2013 R2 - Save Export to Excel” – But it is for Navision 2013 and above.

 

http://saurav-nav.blogspot.in/2014/01/nav-2013-nav-2013-r2-save-export-to.html

 

 What if we want to do the same in Navision Older Version?

 

Here is the way,

 

Step 1 – Create a Field in Setup Table in my case its “Sales & Receivables Setup”.

 

Path


 

Step 2 – Adding that field to Form “Sales & Receivables Setup”

 

Form

 

Step 3 – Add a function “Save Excel File” in Table 370 Excel Buffer

 

Excel Buffer Function

 

Step 4 – Calling from a Report

 

Function Call

 

And it’s done.



Your valuable comments and feedback are appreciated.

"Power is gained by Sharing Knowledge not hoarding it"