Showing posts with label Technical. Show all posts
Showing posts with label Technical. Show all posts

September 17, 2012


TIP #3

Service Creation for opening multiple instances of RTC with different databases

Note: Under Assumption that you are using same port number for all instances.

Please find the below steps for congiguration:

Step #1:

Copy and Paste the Service folder in the same directory as 'Service AO' (AO is the my new service Name)


 
 
 
 
Step #2:

Use the following command in CMD to create new service

SC create MicrosoftDynamicsNAVServer$AO binpath= "C:\Program Files (x86)\Microsoft Dynamics NAV\60\Service AO\Microsoft.Dynamics.Nav.Server.exe $AO"
DisplayName= "Microsoft Dynamics NAV Server AO" start= auto type= own depend= NetTcpPortSharing obj= "NT Authority\NetworkService"

(Note: Now Please check in Services.msc folder, Service has been created. Go to Properties -> Log on and confirm the password).

 
Start the service to check it has been configured properly or not. If service started successfully then stop the service for a while.
 
Step #3:
 
Since we are using same port number for all instances, we need to share the port number. Please follow the steps to do this.
 
  • Go to Run - Service.msc - find Net. Tcp Port Sharing
  • Right-click Net.Tcp Port Sharing Service, and then click Properties.
  • On the General tab, set Startup type to Manual.
  • Click OK to close the Properties window.
  • Right-click Net.Tcp Port Sharing, and then click Start.
 You have now activated port sharing over the TCP/IP protocol.
 
Step #4:
 
We need to convert the Original service of 'Microsoft Dynamics NAV Server' as a sharing service. For that we need to delete and reactivate the service. (Make sure that service has been stopped)
 
Delete Service: (Command Prompt)
 
sc delete MicrosoftDynamicsNavServer
 
Activate Service: (Command Prompt)
 
sc create MicrosoftDynamicsNAVServer binpath= "C:\Program Files (x86)\Microsoft Dynamics NAV\60\Service\Microsoft.Dynamics.Nav.Server.exe"
DisplayName= "Microsoft Dynamics NAV Server" start= auto type= own depend= NetTcpPortSharing obj= "NT Authority\NetworkService"
Step #5:
 
Change the parameters in Custom.config file of Service AO folder and Save it
 
add key="ServerInstance" value="DynamicsNAV AO"
add key="DatabaseName" value="AO"

Step #6:
 
Now Activate the Two services in Services.msc
 
1. Microsoft Dynamics NAV Server
2. Microsoft Dynamics NAV Server AO
 
Step #7:
 
Now You can open Two different databases using RTC
 
 
 
 
--Happy Reading


July 17, 2012

TIP #2

Reading Excel file into table using simple setps

Variables:

XlApp      = Automation = 'Microsoft Excel 14.0 Object Library'.Application
Xlbook     = Automation = 'Microsoft Excel 14.0 Object Library'.Workbook
XlSheet    = Automation = 'Microsoft Excel 14.0 Object Library'.Worksheet
NoOfRows   = Integer
Data file  = Record Variable
Text001    = Sales Data         @2@@@@@@@@@@\\ 
Window     = Dialog
i          = Integer

Code:

CLEAR(XlApp);
IF NOT EXISTS("Data File") THEN
  ERROR('The Specified file %1 not exist',Rec."Data File");
Window.OPEN('#1#############################\\\'+Text001);
CREATE(XlApp,TRUE);
XlApp.Workbooks.Open("Data File");
Xlbook := XlApp.ActiveWorkbook;
XlSheet := Xlbook.Worksheets.Item(1);
NoOfRows := XlSheet.UsedRange.Rows.Count;
Window.UPDATE(1,STRSUBSTNO('Integrating Data...'));


// i=2 means I am reading my excel from second row onwards
FOR i := 2 TO NoOfRows DO BEGIN
Rec."Entry No.":=i-1;
EVALUATE(Rec."Item No.",FORMAT(XlSheet.Range('A'+FORMAT(i)).Value));
EVALUATE(Rec."Name",FORMAT(XlSheet.Range('B'+FORMAT(i)).Value));
EVALUATE(Rec."UOM",FORMAT(XlSheet.Range('C'+FORMAT(i)).Value));
EVALUATE(Rec."Qunatity",FORMAT(XlSheet.Range('D'+FORMAT(i)).Value));
EVALUATE(Rec."Price",FORMAT(XlSheet.Range('E'+FORMAT(i)).Value));
EVALUATE(Rec."Amount",FORMAT(XlSheet.Range('F'+FORMAT(i)).Value));
END;

Xlbook.Close(TRUE);
CLEAR(XlSheet);
XlApp.Quit;
CLEAR(XlApp);

Window.close;


-- Happy Reading 




TIP #1

Selecting a file into text box from Assit Edit

Variables:

DialogWindow = Codeunit = Common Dialog Management
Text000            = Select Your Excel File
Data File          = Record/Global Variable

Code: OnAssitEdit()

    IF ("Data File"= '' ) OR (NOT EXISTS("Data File")) THEN
          "Data File" := DialogWindow.OpenFile(Text000, '', 2{=Excel}, '', 0{=Open});



--   Share your views
--   Happy Reading

October 18, 2011


Creates Line No. automatically for new record

Navision can automatically assign Line No. to a new record if the Line No. is part of the primary key fields. This can be done by setting the AutoSplitKey property in the Form to Yes. By default the AutoSplitKey property is set to No.

Let's consider the following example. When I enter a new sales line record in Sales Order form, Navision will automatically assign Line No. = 10000 to the first Sales Line record. Now, if I enter the 2nd Sales Line record, Navision will automatically assign Line No. = 20000 to the new record. If I insert a new record between the 1st and 2nd record, Navision will automatically assign Line No. = 15000 to the new record.

All this can happen because Autosplitkey property in Form 46 - Sales Line is set to Yes. In order for AutoSplitKey feature to work, the last field in the primary key must be an integerBigIntegerGUIDor decimal field. If you look at the Sale Line table, the Primary key is 'Document Type,Document No.,Line No.', where Line No. is an integer field.

(Post taken from Navision-girl.com)