Business Central

Tuesday, 15 December 2015

How to run NAV 2015 and NAV 2016 Administration tool side by side

Everyone would have installed NAV 2016 and would have faced the same problem, i.e, you couldn't able to run NAV 2015 administration tool if you have installed NAV 2016



One way to use the services of NAV is using powershell. But, many people might not be familiar with commands of power shell.

So, its better go first identify where is the problem and what's the solution for a problem.

The problem is mainly because of registry key. NAV 2015 and NAV 2016 is pointing to the same registry key in registry editor.


If you go to the following path “C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft Dynamics NAV Server.msc” and open Services.msc using notepad as shown below both NAV 2015 and NAV 2016 will point to same key,




There are 2 ways to fix this above problem,

1.
  • Download the registry file
  • You can download the registry file here in my dropbox in the below link,
        https://www.dropbox.com/s/b0thyq7pm8mfb06/2015%20reg%20file.reg?dl=0



2. Or else you can follow the steps manually by exporting the registry file by searching for a key “BA484C42” in registry editor and editing the exported registry file as shown below.






a. Replace all occurrence of key “BA484C42” with “BA484C41”

b. Change the path of “C:\\Program Files (x86)\\Microsoft Dynamics NAV\\90\\RoleTailored Client” to “C:\\Program Files (x86)\\Microsoft Dynamics  NAV\\80\\RoleTailored Client”

c.Modify the “Version=9.0.0.0” to “Version=8.0.0.0”

a
  • Once you are done with any one of the above 2 steps, import the registry file into your registry editor.



Follow the path as shown below and open the services.msc as administrator in your notepad

C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft Dynamics NAV Server.msc


Change the keys from
 BA484C42-ED9A-4bc1-925F-23E64E686FCE 
to BA484C41-ED9A-4bc1-925F-23E64E686FCE as shown in the fig. below.



After the changes are updated for all occurrence of  key you can save the file and now you can run NAV 2015 and NAV 2016 administration tool side by side as shown in below fig.



Sunday, 8 November 2015

Cumulative Updates from NAV

As we all know, Microsoft will be releasing new cumulative updates often to fix various bugs in NAV. So, again there's a release of new Cumulative updates in NAV.

In NAV 2016, CU1 - Build 43402 has been released.

In NAV 2015, CU13 Build - 43389 has been released.

In NAV 2013, R2 CU25 Build - 43391 has been released.

In NAV 2013, CU32 Build - 43390 has been released.

Thursday, 5 November 2015

Virtual tables, Temporary tables, System tables

Virtual tables : They're created by the system at runtime. The tables are read-only, information present in these tables cannot be changed.

It do not store physical information in database.

You cannot insert, modify, delete information in virtual tables.

You cannot view the virtual table or run it from table object designer. But, however you can create a page with source table view property as any virtual table name and run it.

Example:

Consider a date virtual table, Its existence is virtual not visible in object designer. But when we create a page with source table view as "Date" table. We can see the values of Date virtual table in role centered page.

fig. below explains the virtual table in detail.

Create a page with a name 'Date virtual list' and give a source table view as "Date".


when you run the above page you can see the following data's inside the "Date table"





Temporary Tables: (Memory-based table)

They're not physical tables in database. All interaction in a table occurs in memory on service tier.

We make tables as temporary tables so that the processing will be fast. There will be no load on SQL server and network service. It is same as normal tables but the information will be lost once the table is closed.

Commit doesn't affect any temporary tables and error doesn't roll back any changes to temporary tables.

fig. below explains in detail on how to make a table as temporary table.




go to any table designer and  Go to view -> C/AL Globals. Choose a variable with record type and select any table.

Shift+f4 or select properties and make temporary table as 'yes' as shown in fig. below.





System Tables:

We can see the system tables in object designer just like normal table. But, system tables are created automatically whenever we create a database.

When you click on File -> Database -> New

The following dialog will appear,


When you click ok you can see System tables. Fig. shows various system tables present in database.





These tables will be present in each and every database to track system related information like checking active session, setting up permission, check user. You can modify, add/delete data in these tables.


System Tables:

They store physical information in database. Created automatically by NAV.
You can customize, read, write, change, insert, delete information contained in them.
* Security Permission
* Permission Set



Wednesday, 4 November 2015

Difference between page actions and control actions

This is a very simple approach but most of the beginners get confused on these things often while designing page.

If we go to any container with cuegroup. We can see in "View" toolbar -  page actions and control actions.

Always, page actions and control actions behave same at the last line( 1st empty line).
However,

Page Actions:

  • page actions can be seen when you navigate through different areas as shown below.



The design of page is simple select any page and go to design -> view -> page actions as shown below.



Control Actions:

  • Control actions can be seen on role-centered page. 
  • Control actions appear only in Cue group as shown in screenshot below.




    You can view the design of control action by selecting the cuegroup and choosing the control actions in -> view -> control actions.

    fig. below would express the design in a better way.


    As shown in the fig. below go to design of Cuegroup page, select the cuegroup, go to view tab and select control actions. You can see the control actions defined here.



    Friday, 30 October 2015

    Difference between For loop, While loop and Repeat-until loop

    Technically its very important to know when to use for, while and repeat-until loop while we are coding based on the requirement. Since all the 3 loops are used to perform incremental task. Developers must be properly knowing when to use For loop, while loop and repeat-until loop.

    So, the major reason between these three loops is:

    1. For loop:

    For loop is used if we know the number of times the statement needs to be executed.

    FOR var := 1 TO 5 DO

    BEGIN
     //statement
    END;

    output:

    //statement
    //statement
    //statement
    //statement
    //statement

    In this case the statement is executed 5 times.

    2. While loop:

    While loop will not execute if the condition is false.

    var := 0;

    WHILE var <> 0 DO BEGIN
      var := var - 1;
     //statement
    END;

    output:

    In this case the condition is failed. So while loop never gets executed.


    3. Repeat-Until loop:

    var := 0;

    REPEAT
      var := var - 1;
      //statement
    UNTIL var <> 0;

    Output:

    //statement

    In this case as you see whether the condition is true/false but the statement is executed at least once.




    Difference between Upload and Change in License Information

    Usually we will be working on different add-ons and we also update the license depending upon the add-ons of different customer.

    As we all know, We update the license by going to NAV IDE, Tools - > License Information.
    In License Information window we see 3 tabs Upload, Change and Help.

    Everyone will often get confused between choosing Upload / Change while updating the license information. So, its better to know the difference before messing up with assumption.

    When you choose Upload, the license will get loads into Master database of SQL Server. Whenever  you open any NAV database of the server you are working on it will use the same license.

    When you choose Change, the license gets loaded for active session only. When ever you close the current session and open a new client. It will be restored with its earlier license.

    Wednesday, 7 October 2015

    New Features in Dynamics NAV 2016

    As you all know NAV 2016 was made generally available since october 5th world wide. So, its better to know the added features in NAV 2016 before using its actual environment.

    Image source is from Microsoft website









    • Earlier NAV was available only in Desktop, Tablet and web client but now it is also available in phone
    • Power BI - A new tool was introduced recently from microsoft to analyze and organize data. In NAV 2016 it is possible to analyze NAV data since there's an improved integration with office 365.
    • You can bring the NAV 2016 Databases into effective action by using azure SQL Server.
    • It has introduced new functionalities such as posting preview, deferrals and positive pay(only for U.S)
    • Third parties can add their own data sources using NAV 2016. 
    As you saw the additional features in NAV 2016 it is quick to implement and easy to use. 

    Tuesday, 6 October 2015

    Microsoft Dynamics NAV 2016(Formerly Corfu) has been released world wide

    Its a very good new to all Dynamics NAV workers to know that Dynamics NAV 2016 has been released world wide and its now available in following countries.

    AU-Austr​alia​
    AT-Austria
    BE-Belgium
    CA-Canada
    CZ-Czech Republic
    DK-Denmark
    FI-Finland
    FR-France
    DE-Germany
    IS-Iceland
    IT-Italy
    MX-Mexico
    NL-Netherlands
    ​NZ-New Zealand
    NO-Norway
    ES-Spain
    SE-Sweden
    CH-Switzerland
    UK-​United Kingdom
    US-United States
    RU-Russia
    W1

    You can be redirected to download link of Dynamics NAV world wide as below:

    https://mbs2.microsoft.com/fileexchange/?fileID=70f6f135-6769-40df-82cd-92e77e5c02e9

    Monday, 5 October 2015

    To Restore NAV 2009 Missing Data using NAV 2005 FDB file

    I was facing a problem while working on one of the addons i.e I couldn't see any data in NAV 2009 R2 database. But I wanted to test it so I asked my colleagues about how to get data. 

    They guided me many approaches. But one of the simple approach which I felt easy and which I couldn't find anywhere in rest of the blog posts is to restore the data using its earlier fdb file.

    So, I decided to write this blog so that it might be useful to others also. Firstly,

    Open NAV 2005 fdb file in 2009 IDE. This can be done by just double clicking on database.fdb file in the below path.

    (DVD_Folder\CsideClient\program files\Microsoft Dynamics NAV\CSIDE Client\database.fdb)

    Once you double-click that folder, the following dialog box will appear in 2009 NAV IDE.



    Specify your User ID and Password(blank). 



    Specify the .fdb backup file pathname in the Database Name field.

    Following are the steps you need to follow while setting up the 2005 database in 2009 R2.
    Go to Tools - > Security - > Windows Logins - > Specify your User ID in the ID field, -> Click on Roles tab and Select Role ID as 'SUPER' as shown in fig. below.

    fig: shows USER ID                                                  fig: shows Role ID

    Once you are done with this. You can open the database, open the company and start using the data's in various table.


    Tuesday, 25 August 2015

    Difference between FINDSET, FINDFIRST and FIND('-')

    1. FINDSET :


    • Retrieves set of records.
    • Transaction begins with FINDSET Command. 

    2. FINDFIRST : 
    • It will retrieve the first record
    • Retrieves only 1 record, the last one within filter, sorted accordingly.
    • Transactions begins when a call to update the database. (Insert, modify, delete).
    1. Opens the connection with database
    2. fetches the record from database
    3. closes the connection
    Example:


    IF EmployeeVar.FINDFIRST THEN

          MESSAGE('employee no. %1',EmployeeVar."Employee No.");

    Since we are not repeating the process its better to use FINDFIRST if you're fetching only one time from the database.

    3. FIND('-') :
    • It will also retrieve the first record
    • Retrieves only 1 record, the last one within filter, sorted accordingly.
    • Transactions begins when a call to update the database. (Insert, modify, delete).
    1. Opens the connection with database
    2. fetches the record from database
    3. doesn't close the connection until the condition is false.


    IF EmployeeVar.FIND('-') THEN
    REPEAT
          MESSAGE('employee no. %1',EmployeeVar."Employee No.");
     UNTIL EmployeeVar.NEXT=0;


    Since we are repeating the process its better to use FIND('-'), it will work fine even if we use FINDFIRST but each time it retrieves the record it opens the connection and before fetching next record it closes the connection. Which reduces performance. 

    So, it better to use FIND('-) for repeated retrieval of record. 

    Major Differences between Run and RunModal function

    I have browsed through lots of blogs and I nowhere found the proper example on how to use RUNMODAL Function. So, I taught of writing this blog so that it might be useful other NAV Developers.

    RUN Function :


    • The page is opened and you can still go back to what you were doing on previous page.
    • We can switch to other page which is shown.

    RUNMODAL Function:

    • The page is opened and you cannot go back to previous page until MODAL Page is closed.
    • We cannot switch to any other page until current page is closed.


    Example :

    Scenario :

    Assume I want to filter a Customer table who has balance between 10,000 to 1,00000 and to display the filtered values in the Customer list page. You can do the following in the coding part.


    Customer.CALCFIELDS(Balance);//Calculates flowfield values
    Customer.SETRANGE(Balance,10000,100000);//apply filter range
    IF Customer.FINDSET THEN
        PAGE.RUNMODAL(PAGE :: "Customer List",Customer);//opens the filtered list.




    Fig. above shows only the filtered customers based on balance between 10,000 to 1,0000 range.

    Sunday, 12 April 2015

    Some frequently used built-in functions in CAL programming

    As a programmer everyone knows what is function..!! A function is nothing but a subprogram or a subroutine mainly used for code re usability. In CAL programming we call the code of a function as Trigger code.

    Function call is written as same as in C programming-

    result := add(a,2);
    or
    result := add(a+2*3,b);

    Pass by value

    Change i.e. made in function trigger if it doesn't affect the variables in calling trigger then it 's call by value.

    If a change in function trigger affects the variables in calling trigger then it' s call by reference.
    You cannot use constants for pass by reference.

    actual parameter is used in a calling function trigger.
    Formal parameter is used in called function trigger.

    5 commonly used built-in functions are:

    MESSAGE - Displays message on the screen

    STRLEN - returns no. of characters used.
    MAXSTRLEN - returns the defined length of  the string variable.
    COPYSTR - Returns a part or whole of a string.
    CLEAR - clears the passed-in variable.
    ARRAYLEN - returns the no. of elements in an array.

    1. DATA access functions :

    GET, FIND, FINDFIRST, FINDLAST, FINDSET, NEXT 

    GET function-doesn't respect filters, produces run-time error if it fails.

    FIND-You can find a value based on specified key value and sorting order.

    Avoid using find function as much as possible.

    FINDFIRST- to find the first record in a table based on key and filter.

    FINDLAST- to find the last record in a table based on key and filter.

    FINDSET - to find set of records in a table that corresponds to specified set of filters.
    note: In FINDSET you can iterate only from first to last. To iterate from last to first use FIND(+).
    Usually, we use this in combination with repeat-until loop.

    NEXT - used with FIND and FINDSET to step through records of the table.


    2. SORTING AND FILTERING functions : 

    For key selection,sorting and filtering we use these functions.

    SETCURRENTKEY - To select a key for a record.

    SETRANGE - sets a simple range ex. to restrict a phone no. to be b/w 8 to 14 numbers we use this.

    SETFILTER - It includes in more general way, These filtering includes placeholders, operators, wildcard expressions.

    GETRANGEMIN and GETRANGEMAX


    retrieve the minimum or maximum value of the filter that is currently in effect on a field.

    4. DATA MANIPULATION functions

    INSERT - inserts a record in a table

    MODIFY - changes an existing record

    MODIFYALL - performs bulk update of record. Respects filters. It doesn't return values and it doesn't display any errors.

    DELETE - to delete a record from the database. 

    DELETEALL - to delete all records that are selected by the filter settings.

    5. Frequently used functions with fields

    CALCFIELDS - to calculate flowfields,
    if you're accessing record from the code then calcfields must be explicitly specified. 
    Rec or xRec variable is automatically calculated when a record is retrieved. (no need to call here)

    SETAUTOCALCFIELDS - improves performance by reducing no. of round trips to database. 

    CALCSUMS - calculates total of a column in a table. It respects filters.

    note : Maintaining an index for a SumIndexField improves the performance of CALCSUMS, but may decrease the performance of insert, modify, and delete operations.

    FIELDERROR - stops execution of code causing run-time error. It creates an error message for a field. 

    FIELDCAPTION - returns caption of a field. We can show the messages very accurately to user by displaying FIELDERROR along with fieldname. 

    INIT - initializes record by assigning default values. 
    This function is not applied for primary key. 

    TESTFIELD - tests if value of field matches the specified value. 

    VALIDATE - to call OnValidate trigger of a field. It checks the business rules and makes sure that it is not violated by storing invalid value in the field. 

    6. USER INTERACTION functions:

    MESSAGE - displays a text string in a message window. 
    It's displayed after CAL code finishes execution or when it waits for user interaction. 
    % - placeholder
    \ - new line character 

    CONFIRM - prompts the user for yes/no option. (to confirm that user wants to continue with the process)

    STRMENU - creates a menu window that displays series of options from a comma-delimited string.

    ERROR - displays error message and ends the CAL execution. All uncommitted data are rolled back. 


    7. String Functions:

    MAXSTRLEN, STRLEN, STRPOS(case sensitive), COPYSTR, LOWERCASE, UPPERCASE, INCSTR, SELECTSTR(retrieves sub-string from a comma separated string).

    8. Date Functions:

    DATE2DMY, NORMALDATE, CALCDATE, CLOSINGDATE

    9. Numeric functions:

    ROUND, ABS, POWER, RANDOM, RANDOMIZE

    10. ARRAY functions:

    ARRAYLEN,COMPRESSARRAY, COPYARRAY

    11. STREAM functions:

    CREATEINSTREAM, CREATEOUTSTREAM, READ, READTEXT, WRITE, WRITETEXT, EOS, COPYSTREAM,

    12. System functions:

    EXIT, CLEAR, CLEARALL, EVALUATE, FORMAT




    Thursday, 26 March 2015

    How to Create your own table and make a report of it..!!

    Always it is necessary to create a table with your own scenario because that will improve your creativity mind and will also give you a deep knowledge of how to learn things quickly. So, Now I'm going to show a scenario based on movie list.

    I'm going to explain how to create a table along with how to create a report linking two tables


    1.       Create table with name MovieMakingTable with fields including (Serial no., movie name, sensor certification,audience rating, production cost)
    2.      Set Serial no. and production cost as primary key, because you need to relate two tables based on serial no. and movie name can be repeated with  d/f serial no. based on different productions. In order to repeat names for same serial no. we also take sum of productions as primary key.
    3.      Let the properties of this table be not disturbed.

    1.       Create MovieMaking table with fields including(film code, director name, email, ph. no, profit, sum of productions,director, producer name , shooting locn and no. of ppl involved)
    2.      Set film code as primary key.
    3.      In Salary field properties,
    Go to field class and select FlowField(to sum the production cost of each directory of movie released table we chose flow field)
    4.      Now, update CalcFormula by choosing assit edit
    Select method as Sum, table as –MovieReleased table
    Field-production cost
    Table Filter-Based on serial code, type-field, Value-film code
    5.      Now, the code you ‘ve developed will sum up the table of each director and will display the sum in another table.

    Now, we should filter the table displayed in moviemaking table based on movie rating and sensor certification.

    1.       Come back to Movie released table. Create a field called type and choose option as datatype (give option string property with values U,U/A,A).
    2.      Save and come back to MovieMaking table. Create two fields called Audience rating with datatype as option(set option string property with values 1,1.5,2, so on upto 5) and create another field called Sensor certification with its data type as option(set option string property with values U,U/A,A).
    3.      Select flow filter in field class property for these two newly created fields)

    1.       Come back to sum of production field of movie making table and go to its calcformula property, go to table filter, Add two additional fields called search based on certification and search based on rating, type is option. Click Ok and Save.
    2.      Run the Moviemaking table type ctrl+shift+F3 add filter select either (select by date or select by month or both) and you’re done with the task.


    MovieList Table- 2 different tables  that has been created



     Create a Table link report for Customer Table and Customer Ledger Table with your selected columns from these two d/f table. Sort with only date column by removing time and calculate net amount and total amount.
         
        
      1.       Add new Report, Create DataItem and select DataSource table as Customer, select properties of DataItem Set DataItemTableView Assist Edit
    Select key as No., order-ascending, Table Filter-(field-balance, type-filter, value>0)
       2.      ReqFilterFields property – No., Name
       3.      CalcFields Property-Balance(LCY),save and compile.
       4.      Select FieldMenu and select columns customer no.,name,name2 and balance(LCY).

       1.       Create another DataItem with data source as CustomerLedger Entry table.
     2.      Go to properties of DataItem, choose DataItemLinkReference as Customer and DataItemlink Field-Customer No., Reference Field-No. 
      3.      Select field menu and add columns(entryno., customer no., posting date,amount) save and compile.
      4.      Goto View-Layout.
      5.      Drag a table and give tablix properties-select datasetname as datasetresult.
      6.      Create a header row with customer no. ,name, name1 and balance details)
       7.      Next row-add parent header values.
       8.     Next row-add child header(entry no.,custno, posting date, amount).
       9.      Add details in next row.
      10.  Calculate individual total amount and net amount. Finally save, compile and preview. To calculate sum(double click on column and add a text as sum).
    Ex. [Sum(Amount_CustLedgerEntry)] compile and save
      11.   If you need to filter by date and remove time, select posting date details column, on the right bottom corner on properties window go to Number header, Format give value as d. save and compile.
    Customer Report created between two tables









    Monday, 16 March 2015

    Some basic things to know before working on MS Dynamics NAV



    To know which version of MS Dynamics you are using-


    Click on Help and select ‘about Microsoft dynamics NAV development environment’

    A window appears which shows the latest version you have been upgraded and the product is licensed to Microsoft and some more information.


    Difference b/w version and version list in MS Dynamics NAV



    Version
    Version List
    It displays the latest version i.e. being used in MS Dynamics NAV
    (upgraded version)
    It displays the version of various objects which were added some extra features. It differs from 1 object to another or from 1 field to another.
    It shows licensed information
    It doesn’t show any such things
    We can’t edit in version window
    We can edit in version list column
    It is used to know the details of which version we’re using
    It used mainly to update the changed information.
    Ex. Suppose developer ‘A’ will change a customer table and move to some other project after few months. To know which table the developer modified we edit version list column.
    (if the version list of column is 12345.34, we edit it has name,12345.34. So that we will come to know who actually modified which column)



    Some rules to be followed while changing field id or table id


    Suppose we are modifying any existing table i.e. created by Microsoft then the field no. of that existing table should be between 50,000 to 99,999 disagreeing this will lead to compile time error.

    Suppose we are creating any new table then the table id should be assigned the no. b/w 50,000 to 99,999 disagreeing leads to CTE.  If we’ve created a new table then that field no. can take any no > 0. To know more about this id go through architecture of NAV.


    Do’s and Don’ts while working on NAV IDE

    ·         Don’t compile and save if you have not did any changes on objects.
    ·         If you save and compile without any changes then there will be a check mark on the modified screen. Other developers will get confused and waste their time by also reviewing this unchanged saved object. (instead just escape if you are not changing any fields)
    ·         All the table name, field name and word after space should begin with capital letter.


    Locked and Unlocked


    When several developers use the same database then it’s better to lock and work by particular developer so that no one except him can edit or modify or save. Others can only view the locked content but cannot modify.
    Only the locked developer can unlock. If there’s any case to unlock when the locked developer is not available then you can choose forced unlock option.




    Import and export to and from the file.
    Import means uploading any file from drive to nav software.
    Export means saving a file from nav software to drive.



    Extensions used in dynamics NAV

    License file is stored as .flf
    In 2009 native db was saved as (.fdb) now in 2015 its no more used.
    Objects are saved as .fob

    Note: Its better to save any object you are using both in .fob and .txt format.


    Toggle mark

    Sometime there arises a case to save 3 or more object elements to a single file we do this by using toggle mark (to select object elements we need to save), go to view click marked only and click all button below objects window then select all and save to your desired location.



    Difference b/w upload and change in license information

    Change will only affect table or any other objects but changes are not made at role tailored client.
    Upload will do changes both on objects elements and also on role tailored client.



    Know More-


    Option - It will show some information, path where we’re saving etc.

    Autolock - will automatically lock your data’s so that it cannot be modified by anyone.

    Prevent data loss from table - you cannot delete any fields which you created.