Friday, November 27, 2009

How to read BLOB data and export into a File

In Microsoft Dynamics NAV tables, we can create BLOB fields to store large amount of data. It is not possible to read the data in the BLOB fields directly.

The following steps shows the procedure to read the BLOB data. In this example, I have taken “User Metadata” table to read the data in the “Page Metadate Delta” field.

1) Create a codeunit with the below variables.

Name DataType Subtype Length
UserMetadata Record User Metadata  
Data InStream    
Line Text   1024
Pos Integer    
File1 File    

2) Add the following code to the codeunit.

image 3) Save and Run the codeunit. Text file will be created in the given path with the data in the BLOB field.

Thanks,

Veerendra CH.

Thursday, November 26, 2009

Understanding the Difference Between GP, NAV, SL and AX

Here is the nice post from Houston Neal on “Understanding the Difference Between GP, NAV, SL and AX”.

Please click the link to read this post.

Monday, November 9, 2009

Object Subtype field in the AllObjWithCaption table

In Microsoft Dynamics NAV, AllObjWithCaption table is one of the virtual table from the older versions.

This AllObjWithCaption virtual table holds all the objects details like Type, ID, Name and Caption.

One new field Object Subtype is added to this table in NAV 2009.

image

This field is used to store subtype of two object types. 1) Codeunits 2) Pages

Codeunits has three Subtypes.

1) Normal: These are normal coduenits.

2) Test: Testing Codeunit

3) TestRunner: Test runner codeunit, used to run the Test Codeunits.

Pages has different subtypes like Card, List, Worksheet, Document, etc…

Saturday, October 24, 2009

How Run button in Object Designer opens the page in the RTC

In the NAV 2009 SP1, it is possible to run the Page from the Object Designer.

image In the Object Designer, Run button will open the related page in Role Tailored Client. I think this is achieved using the HYPERLINK function in Navision.

HYPERLINK function passes a URL as an argument to an Internet browser.

By adding the following code in OnPush Tirgger of any button will open the related page in Role Tailored Client.

HYPERLINK('DynamicsNAV:////runpage?page=' + FORMAT(ID));

Here ID valud should be Page ID.

The above code can also be applied to open the reports in Role Tailored Client.

HYPERLINK('DynamicsNAV:////runreport?report=' + FORMAT(ID));

The above line of code can be added to any form/page to open the pages/reports dynamically.

Transformation Tool: Subfrom Menu Items to Pages

Using Transformation Tool it is possible to transform forms to pages in NAV 2009.
Forms like Sales Order, Purchase Order has Line Menu Button in the Main from and Transformation Tool automatically transforms the Line Menu button to the Sub page (ListPart). If the Menu Button has any Menu Items, Transformation Tool will also move the Menu Items to the Sub page.

Logic behind this is,Transformation Tool moves the Menu Item to Sub page if it finds the code like “CurrForm.subform.FORM.FunctionName” in the Onpush of the menu item.
Sales Order—>Line—>Reservation Entries, OnPush trigger has the following code.
CurrForm.SalesLines.FORM.ShowReservationEntries;
image

For example if you want a confirmation message before opening the reservation entries, you can write the code in the function or you can write like below:
IF CONFIRM(Text123,TRUE) THEN
  CurrForm.SalesLines.FORM.ShowReservationEntries;

If the code is like above, Transformation Tool will not move this Reservation Entries menu item to sub page. It will create a new Line menu button in the main page and add the Reservation Entries menu item to that.
image
TIP: If your requirement needs to write code before calling the function in the subform, maintain the code in single line like the following:
IF CONFIRM(Text123,TRUE) THEN CurrForm.SalesLines.FORM.ShowReservationEntries;

Saturday, October 17, 2009

How to change SQL Server default backup location

As part of my job, I need to create databases regularly. Because of this I made a SQL Backup of the database with required objects and necessary setup. When ever I try to create a database, SQL Server is showing the default path of the backups.

It is possible to change the default location of the SQL Server backup files:

If we open the registry using REGEDIT or some other tool and if you navigate to this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLSERVER and change the BackupDirectory value to the required location.

image This solved my problem and saved some time.

Monday, October 12, 2009

ProviderID property to System Parts

Last week after posting the learning on ProviderID property, I am going through the mibuso and found any interesting post related to the ProviderID linking to the System Parts.

I also tried to achieve this, but not able to find any solutions except create a new list page and adding system part to that.

The solution kine has given is working.

-Create a list page based on Sales Line.

-Add only two line. One Container and another Part.

-Change the Parttype to System and SystemPartID to Recordlinks for the part.

-Add the new list page to sale order form as Factbox

-Set the ProviderID and SubFormlink.

This solution is working as temporary.