July, 2009

  • Microsoft Dynamics NAV Team Blog

    Planning Rollup Update for Microsoft Dynamics NAV 5.0 SP1

    • 6 Comments

    The Planning Rollup Update for Microsoft Dynamics NAV 5.0 SP1 has been released! Take a look at the following links on PartnerSource and CustomerSource for information about what's included in the update and for download and installation details.

    PartnerSource: https://mbs.microsoft.com/partnersource/support/selfsupport/hotfixes/MSD_NAV5SP1RollupUpdateJune09

    CustomerSource: https://mbs.microsoft.com/customersource/downloads/hotfixes/MSD_NAV5SP1RollupUpdateJune09

  • Microsoft Dynamics NAV Team Blog

    Style Sheet Tool 2.0 now available

    • 5 Comments

    A new version of the Style Sheet Tool for Microsoft Dynamics NAV is now available. This will also support Microsoft Dynamics NAV 2009 and our upcoming SP1 release.

    Please find it here:

    CustomerSource: https://mbs.microsoft.com/customersource/downloads/servicepacks/NAVStyleSheetTool

    PartnerSource: https://mbs.microsoft.com/partnersource/deployment/resources/supplements/NAVStyleSheetTool

    Thanks to Robert Miller for making this happen

    /Claus

  • Microsoft Dynamics NAV Team Blog

    Index Usage Information Tool

    • 4 Comments

    Attached at the end of this post is a set of NAV objects that collects index usage information, and displays it in a NAV client so that you can sort tables by no. of Indexes / Index Reads / (Index) Block wait time, etc.:

     

    IUITList

    The tool is using these three SQL Queries / DMVs:

    • sys.indexes: Basic information about indexes
    • sys.dm_db_index_usage_stats: No. of Index Reads, updates, etc
    • sys.dm_db_index_operational_stats: Index blocking / wait time etc.

    The information that is collected is already described in these posts:

    So the new thing is that now the information is read into NAV, making it more easy to browse through it, get an overview, and having information from various queries collected in one place.

    Note:

    • The tool, relying on Dynamic Management Views (DMVs) will only work for SQL2005 and later (not SQL2000).
    • The information that is collected is since last time SQL Server was restarted.

    The tool contains the following objects:

    Type ID Name
    Table 74100 IUIT Setup
    Table 74101 IUIT Index
    Table 74102 IUIT Table
    Form 74100 IUIT Setup
    Form 74101 IUIT Index List
    Form 74102 IUIT Table List
    Codeunit 74100 IUIT Mgt

    And it assumes that you have a partner's developers license.

    To run it:

    Run form 74102 "IUIT Table List". First set up the SQL connection by clicking Table -> Setup, and specify SQL Server Name, Database Name and credentials.

    Then go back to the "IUIT Table List"-form, and click Functions -> Update.

    After the tool has collected the information (takes a few minutes), you can sort your tables by a number of factors which can all affect performance. And you can look at indexes for each table (Table -> Indexes (Ctrl+F5)), and get statistics for each individual index.

     

    These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

    Lars Lohndorf-Larsen ( Lohndorf)

    Microsoft Dynamics UK
    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    What is new in Dynamics NAV 2009 SP1 for Reporting

    • 3 Comments

    With our Microsoft Dynamics NAV 2009 SP1 Community Technical Preview released it is now time to drill into the new features we have been for working on for reporting in NAV 2009 SP1.

    1. Drill Through to a report from a report

    In NAV 2009 it was possible to Drill Through from a Report to a Page, see how this is done here.
    With the possibility to Drill Through from a report to Page, we had a strong request from partners and customers to add the possibility to Drill Trough from a Report. So in NAV 2009 SP1 it is now possible to Drill Through from a Report to a Report. So how is this done? Well this is not done the way we Drill Through to Pages, but with the use of filters.
    A Drill Through to a report could look something like this:

    ="DynamicsNAV:////runreport?Report=104&Filter=Customer.%22No.%22:"+Fields!Customer__No__.Value

    The first part “DynamicsNAV:////runreport?Report=104” is our well know way to link to reports and pages. If you are new to this linking in NAV 2009 read more here.

    The last part “&Filter=Customer.%22No.%22:"+Fields!Customer__No__.Value” is what is new for NAV 2009 SP1. The first part will open Report 104, and with the last part, report 104 will be filtered on the “Customer__No__.Value”. If we add this code to a Customer Top 10 List report, we can Drill Through to report 104 both from the List and the Pie Chart. I have made a small video how that is done. The video is in the zip file that is attached to this blog post.

    2. Paging

    In NAV 2009 the dataset creation was done on server, before it was sent to the requesting client. With this approach, the memory consumption on the server could potentially be very large with multiple user requesting reports at the same time. For this reason we have implemented paging in SP1. With paging the memory footprint on the server is minimal. When the dataset for a report is generated, we are now sending small chunks of the dataset to the client, and thereby building up the dataset on the client. With this approach the client is now taking the memory hit and not the server. I have made small video that illustrates how the dataset was build up in NAV 2009 and in NAV 2009 SP1. The video is in the zip file that is attached to this blog post.

    3. About this Report

    In NAV 2009 we had the possibility to zoom into the dataset of a report. We also had a very short short as well SHIFT+CTRL+ALT+F12 :-) but in SP1 we have reintroduced the zoom feature for Pages as well. We decided to call this “About this Page”. “About this Page” and can be found in the help menu on all pages. For reporting we aligned this, so in Report Preview we now have a menu called “About this Report”. Also the shortcut is aligned, so this is now CTRL+ALT+F1.

    4. Progress Indicator

    With paging introduced in SP1, it gave us the possibility to add a Progress Indicator, while the dataset is being created and sent in chunks to the client.

    • You will now be able to see how long the dataset generation has taken
    • You will be able to see how many rows has been received from the server
    • And at last you will be able to cancel a report, something which was not possible in NAV 2009
      image

    Note: When dataset  has been sent to the client Progress Indicator will disappear and Report Viewer will starter rendering the report. Based on the logic in your layout this can take more time than the actual dataset generation. You will be able to stop this generation by clicking the stop button in the Report Viewer while the report is being generated.

    image

    5. Matrix reports

    We now also supports Matrix reports, so we can do things like this:

    image

    6. Visual Web Developer 2008

    We now have full support for Visual Web Developer 2008, so it is no longer needed for you to do the “hack” I described here. Note: As of April 1st. Visual Web Developer 2005 has reached EOL, which means it can no longer be downloaded from Microsoft.com

    7. External Images

    In NAV 2009 it was possible to add both embedded images and images from the NAV database. With NAV 2009 SP1, it will now also be possible to add external images to your report.

    I hope you appreciate the new reporting features which will be available in NAV 2009 SP1. And as always I’m happy to get feedback for reporting features you would like for us to implement in future releases. So use the Contact Form to write directly to the core reporting team in Navision(Dynamics NAV) :-).

    Thanks,
    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    SP1 Update to Microsoft Dynamics NAV 2009 Developer and IT Pro Help

    • 1 Comments

    Microsoft Dynamics NAV 2009 Developer and IT Pro Help has been updated to Microsoft Dynamics NAV 2009 SP1 and is now available on MSDN and the Microsoft Download Center. In addition to new content for SP1, this release expands on existing content and addresses some important support call issues, such as Outlook integration.

    Some of the highlights of the updated help include:

    • Outlook Integration and Synchronization
    • Extending the RoleTailored client using control add-ins
    • Security in the RoleTailored Environment
    • Installation Walkthroughs
    • Multiple Time Zones
    • Report-to-report links
    • Control and menu IDs on transformed pages
    • About This Page and About This Report
    • Page Designer

    If you have any questions or comments, contact the NAV UE Platform team.

    You can get the Microsoft Dynamics NAV 2009 SP1 Community Technical Preview release on PartnerSource.

    - Bob, Jill, and John (the NAV UE Platform writers)

     

  • Microsoft Dynamics NAV Team Blog

    Sure Step is Now Available to All Microsoft Dynamics Partners

    • 0 Comments

    Doug Kennedy, Vice President Dynamics Partner Team, announced the availability of Microsoft Dynamics Sure Step today to all Dynamics partners - as part of the Worldwide Partner Conference Dynamics Keynote in New Orleans. Starting July 13, 2009, Sure Step is available to all Dynamics partners  to help drive increased partner productivity, better partner collaboration and improved customer satisfaction. For more information, see the Microsoft Dynamics Sure Step page on PartnerSource.

  • Microsoft Dynamics NAV Team Blog

    Report Design in Microsoft Dynamics NAV 2009

    • 0 Comments

    We have now released training material for designing reports in NAV 2009.

    This training will teach the learners about the concepts of Report Design in NAV 2009 using VS Report Designer along with the limitations and workarounds in Report Design. It covers the new options with practical examples on creating reports in report design, creating and defining data set within NAV 2009 to be used in Visual Studio. In addition, it covers how to implement dynamics features like interactive sorting, conditional formatting, visualizing data using graphs, document maps, creating expressions. Furthermore the training contains information on best practices and recommendations for creating interactive dashboard reports containing KPI’s.

    At Training Material Completion
    After reviewing this training, individuals will be able to:

    • Understand the new architecture and reporting features in Microsoft Dynamics NAV 2009.
    • Create table and matrix reports for the Microsoft Dynamics NAV RoleTailored client in Microsoft Visual Studio.
    • Add interactive features, such as Visibility Options, Interactive Sort, Document Maps, and Pictures to the report.
    • Use expressions and custom code in RoleTailored client reports.
    • Integrate reports in the RoleTailored client user experience.
    • Run RoleTailored client reports in various ways.


    You will find the training material at CustomerSource here:
    https://mbs.microsoft.com/customersource/training/trainingmaterials/student/course80146.htm

    Thanks,
    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    SPN name Changes

    • 0 Comments

    It should be a common installation scenario to have NAV 2009 components installed on three different machines, one for the database hosted by SQL Server, one for the Microsoft Dynamics NAV Server (middle tier server) and the corresponding client machines. This installation is explained in MSDN “How To: Set Up Delegation”, however, what I wanted to talk about is the difference in SPN naming from 6.0 RTM and 6.0 SP1 (or hotfixes which are build 28795 or higher).

    The names used before were in the format “NAVSERV_DynamicsNAV/NAVSERV.yourDomain.yourCompany.com:7046”, the new name conventions are:

    DynamicsNAV/NAVSERV.yourDomain.yourCompany.com:7046”, and

    DynamicsNAV/NAVSERV:7046

     

    Both names should be registered, to minimize possible issues.

    This change should simplify the “Three tiers” installation in relatively complex name networks, for instance, when it contains multiple A or CNAME records.

    -- jtorres

  • Microsoft Dynamics NAV Team Blog

    Where is the zup file again?

    • 0 Comments

    I keep forgetting where the CustomSettings.config, ClientUserSettings.Config etc files are. So I keep looking it up again in "Where is the zup file". This time, I collected the location of these files in a NAV form so I don't have to look them up anymore. In addition to this you can edit the files from the form directly. It looks like this:

     

    ZupForm 

     

    The first time you run the form it will insert a record with the default settings. If your installation is in different folders, then you can of course just modify this. You can also create new records in case you have multiple NAV2009 installations / config files.

    Note: If you run on Vista / Win2008 and want to update the config files from here, then you may have to start your NAV client as Administrator, or you may get "access denied" when clicking the update button.

     

    RunasAdmin

     

    I hope this makes it simpler to change setup settings. Objects attached are:

    Type ID Name
    Table 74250 NAV2009 Config Files
    Form 74250 NAV2009 Config Files Card

     

    Instructions for use: Run form 74250. 

    As always, these postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

    Lars Lohndorf-Larsen

    Microsoft Dynamics UK

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    Strange errors come during change SourceExpr value in NAV report designer...

    • 0 Comments

    Our colleague raised problem: why he receives strange error during report compile, after he changed SourceExpr value for some control in report designer in NAV 2009.

    Error message was:

    Error while validating RDL content:
    The Value expression for textbox “CompanyInfo” refers to the field ‘PricesInclVAT_YesNo’. Report Item expressions can only refers to fields within the current data set scope or, if inside an aggregate, the specified data set scope.

    Error itself looks very strange because:
    1. It comes from validating RDL content, but we changed nothing in it.
    2. Changed was SourceExpr in NAV classic client report designer>sections>control property, and it has no relations to field mentioned in error. Actually what was changed: report 204 – Sales-Quote; control 116; SourceExpr had value "Sales Header"."Prices Including VAT" and now it has value FORMAT("Sales Header"."Prices Including VAT").

    If we change back value – error disappears.

    After deeper analyze we found that RDL dataset has field ‘PricesInclVAT-YesNo’, but after report designer change SourceExpr value by adding FORMAT – this field disappears from dataset. So problem really is in the SourceExpr value, however value itself is correct. And after few more research we found there is control 167 – name PriceIncVAT_YesNo which has exactly the same SourceExpr value - FORMAT("Sales Header"."Prices Including VAT").

    Conclusion: only one source expression is pushed to RDL, if there are few controls with the same SourceExpr, only first will be in RDL, other will not appears there.

     

    I asked NAV architects about this issue and they answered:

    The field names that we show in the RDL dataset do NOT come from the SourceExpr property "directly". Each control on a report has a DatasetFieldName property, which is what we use to build the field names in the RDL dataset.

     

    The DatasetFieldName property is then derived from the SourceExpr property the first time you open Visual Studio for a report using the View --> Layout menu item. After this, if you change the SourceExpr, the DatasetFieldName does not get changed. (The whole purpose of this property is to fix the dataset field name so even if you change your SourceExpr, you won’t need to redesign your RDL). This should cover most of the user scenarios.

     

    In a few scenarios, you are not covered though: one is, if you move sections or controls in the layout, and if two controls have the same SourceExpr value, the control we choose to export to the report dataset may change with another one with the same SourceExpr. Since they have different DatasetFieldName properties, your RDL will break. We don’t cover this scenario and we don’t believe that we could fix this easily.

     

    In another scenario: if you change the SourceExpr, and the data type of the new field is different than the old one, RDL compilation may fail due to the expressions used on that field - as these are data type dependent.

    So, during report design be very careful with modifying 2 properties: SourceExpr and DataSetFieldName. Changes could impact RDL very much and result could be not you are expecting. Of course this is important if you already have RDL report prepared, if you will create new layout by using "Laoyout suggestion", problems will not come, because new RDl laoyout will be created regarding earlier described rules.

    These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

    Special thanks to John Vestergaard from Logica Danmark A/S for pointing us to this feature.

    Gedas Busniauskas (gediminb)

    Microsoft Lithuania
    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    How to read a SQL Profiler trace file into a SQL table

    • 0 Comments

    Just a small tip that I use often when I have a large SQL Profiler trace. Rather than reading through trace files line by line, you can read it into a table and then query it. This syntax creates a new table in SQL Server and loads your trace file into it:

    SELECT * INTO MyTraceTemp

    FROM ::fn_trace_gettable('c:\x\MyTrace.trc', default)

     

    The default parameter means that if the trace is across multiple trace files, it will automatically read the next trace file(s) too. If your trace consists of a lot of trace files you can limit how much you read by setting it to for example 3 to just load the first three files.

    Once you have the trace file in your table it might be a good idea to add indexes on the table, for example an index for Reads and one for Duration. Then query it, like this for example:

    SELECT Reads, Duration, * FROM MyTraceTemp ORDER BY Reads DESC

     

     

    Lars Lohndorf-Larsen (Lohndorf)

    Microsoft Dynamics UK

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    How to set dynamically the Key and Sort Order for the pages using NAV 2009 Web Services feature

    • 0 Comments

    The default methods exposed when a page is published are the so-called CRUD (Create, Read, Multiple and Delete) methods. All of those does not allow to set up previously a key for sorting order nor if the records have to be ascending or descending.

    In order to retrieve data in a particular sorting order it should be necessary to develop N pages for N related sorting keys. This can be a solution that deserve the analysis of the cost of the pages plus the maintenance of the source objects.

    Another way to set the Key and Sort order for pages object is described here. It only has the cost of purchasing one table that collect the User ID, the page called (Page ID) , the Key used and the Sort Order, plus one page to publish the table and only one page per master table. This will avoid the cost of N pages for master table per N Sorting order keys.

    The following example is based on Customer table and has the purpose of develop a WinForm that dynamically retrieves data from the server based on a selected sorting order like in the picture below (just 3 keys have been used here):

    clip_image002

    PREREQUISITES

    1. Install NAV 2009 + Web Services components

    2. This example has been developed using the following scenario:

    - Windows Server 2008 x64

    - SQL Server 2005 SP2 x64

    - NAV 2009 IT RTM

     

     

    A. CREATE THE OrderBy TABLE

    1. Create a new table (e.g. 50000) and give it the name OrderBy with those fields:

    - User ID Text 65 (used to store the USERID)

    - Page No. integer (Number of the page published as WS)

    - OrderByInt integer (store the number of the key used)

    - SortOrder Boolean (TRUE means ASC, FALSE means DESC)

    clip_image004

    2. Save and compile the table (e.g. 50000 OrderBy)

     

    B. CREATE THE OrderByWS PAGE

    1. Create a new page (e.g. 50001) based on the OrderBy table previously created (e.g. Table 50000) and give it the name OrderBy. This page will be published as Web Service and will expose all its own CRUD methods.

    - PageType property: Card

    - SourceTable property: OrderBy

    2. Select all the fields of the table using the classic Field Menu and put all of them into a group:

    - "User ID"

    - "Page No."

    - OrderByInt

    -SortOrder

    clip_image006

    3. Save and Compile (e.g. 50001 OrderBy)

     

    C. CREATE THE CustomerWS PAGE

    1. Create a new page (e.g. 50002) based on the Customer table (Table 21) and give it the name CustomerWS. This page will be published as Web Service and will expose all its own CRUD methods.

    - PageType property: Card

    - SourceTable property: Customer

    2. Select the fields reported below by using the classic Field Menu and put all of them into a group

    - "No."

    - Name

    - Address

    - "Country/Region Code"

    - City

    clip_image008

    3. Click on View > C/AL Globals > Functions tab

    4. Create a new function called SetPageKey

    5. Click on Locals button and create a new Local variable for the SetPageKey function:

    OrderByRec Record OrderBy

    5. Close the C/AL Globals form

    6. Edit the C/AL Editor of the page by pressing F9 and start adding C/AL code to your page

    7. In the OnInit trigger write this line:

    SetPageKey; //Call the SetPageKey function

    8. In the SetPageKey function write this sequence of C/AL code:

    IF OrderByRec.GET(USERID,50002) THEN BEGIN

    CASE OrderByRec.OrderByInt OF

    1 : SETCURRENTKEY(Name);

    2 : SETCURRENTKEY("Country/Region Code");

    ELSE

    SETCURRENTKEY("No.");

    END;

    ASCENDING(OrderByRec.SortOrder);

    END;

    9. Save and compile the page (e.g. 50002 CustomerWS)

     

    D. PUBLISH YOUR PAGE AS WEB SERVICES

    1. Run Table 2000000076 Web Service

    2. Insert the following lines

    Object Type Service Name Object ID Published

    Page Cust WS 50002 Yes

    Page OrderBy WS 50001 Yes

    clip_image010

    3. Once you have ticked the Published control, your page should be published as Web Service in your environment. To verify this you can easily check it out at:

    http://<SeverName>:<WebServicePort>/<ServiceName>/ws/<CompanyName>/Services

    that in this scenario has to be:

    http://dtacconit7400:7047/DynamicsNAV/ws/CRONUS_Italia_S_p_A/Services

    clip_image012

    for more information on working with Web Services, please refers to MSDN at:

    http://msdn.microsoft.com/en-us/library/dd355036.aspx

     

    E. DESIGN YOUR CUSTOMER WINFORM

    1. Open Visual Studio 2008

    2. Create a new WinForm VC# project

    3. Add Controls to the form:

      a. Button control

        (name) - btnLoadData

        Text - Load Data

      b. 3 RadioButton controls + GroupBox control (Text - Key)

        (name) - rbNo

        Text - Customer No.

        (name) - rbName

        Text - Name

        (name) - rbCountry

        Text - Country

      c. 2 RadioButton controls + GroupBox control (Text - Order)

        (name) -rbAsc

        Text - Ascending

        (name) - rbDesc

        Text - Descending

      d. DataGridView

    clip_image014

    4. Add Reference to your Web Services.

      a. In the Solution Explorer, right click on References > Add Web Reference

      b. Click on Add Web Reference

      c. Paste the link to the URL related to the Services and click Go:

    http://dtacconit7400:7047/DynamicsNAV/ws/CRONUS_Italia_S_p_A/Services

    clip_image016

      d. Click on View Service in the Cust_WS service row and change the Web Reference name to:

    CustWRN (customer web reference name)

      e. Click on View Service in the OrderBy_WS service row and change the Web reference name to:

    OrderByWRN (OrderBy web reference name)

    clip_image018

    5. Link the DataGridView to the CustWS service

      a. Click on the right arrow in the upper right position of the DataGridView

      b. In the DataGridView Tasks click on Choose Binding Source

      c. Explode the tree and select CustWRN, a brand new CustWSBindingSource will be created

    clip_image020

      d. Return to DataGridView Tasks and untick all the Enable check boxes

      e. Click on Edit Columns and add all the fields present (tip: change some of the column properties in order to let the DataGridView display the data properly), click OK.

    clip_image022

     

     

    F. WRITE C# CODE TO LET THE WINFORM ANIMATE…

    Add the C# code into your form to let it work as expected.

     

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Linq;

    using System.Text;

    using System.Windows.Forms;

    using System.Security.Principal; //Namespace useful to retrieve the login

    namespace OrderBy

    {

    //Use 2 Web References based on Order By Page, Customer Page

    using OrderByWRN;

    using CustWRN;

    public partial class Form1 : Form

    {

    //Declare 2 WS Variables

    private Cust_WS_Service CustWSService;

    private OrderBy_WS_Service OrderByService;

    //Create the integer variables related to the RadioButtons

    // for the Order By and the Sorting

    private int OptChoice;

    private bool SortChoice;

    public Form1()

    {

    InitializeComponent();

    //Default Key used = Customer No. (You can always change this code to retrieve

    // it from the last access to the WinForm)

    OptChoice = 0;

    SortChoice = false;

    rbNo.Checked = true;

    rbAsc.Checked = true;

    //Instantiate Customer Page WS and set the correct URL

    CustWSService = new Cust_WS_Service();

    CustWSService.UseDefaultCredentials = true;

    CustWSService.Url = "http://dtacconit7400:7047/DynamicsNAV/ws/CRONUS_Italia_S_p_A/Page/Cust_WS";

    //Instantiate OrderBy page WS and set the correct URL

    OrderByService = new OrderBy_WS_Service();

    OrderByService.UseDefaultCredentials = true;

    OrderByService.Url = "http://dtacconit7400:7047/DynamicsNAV/ws/CRONUS_Italia_S_p_A/Page/OrderBy_WS";

    }

    private void rbNo_CheckedChanged(object sender, EventArgs e)

    {

    OptChoice = 0;

    }

    private void rbName_CheckedChanged(object sender, EventArgs e)

    {

    OptChoice = 1;

    }

    private void rbCountry_CheckedChanged(object sender, EventArgs e)

    {

    OptChoice = 2;

    }

    private void rbAsc_CheckedChanged(object sender, EventArgs e)

    {

    SortChoice = true;

    }

    private void rbDesc_CheckedChanged(object sender, EventArgs e)

    {

    SortChoice = false;

    }

    private void RetrieveRecords()

    {

    //Create a new Customer recordset

    Cust_WS CustomerRset = new Cust_WS();

    //Create a new set of filters (empty)

    List<Cust_WS_Filter> CustFilters = new List<Cust_WS_Filter>();

    //Feed the data grid with the recordset retrieved by the ReadMultiple

    // CRUD method on Customer Page and retrieve the first 100 result records

    dataGridView1.DataSource = CustWSService.ReadMultiple(CustFilters.ToArray(), null, 100);

    }

    private void btnLoadData_Click(object sender, EventArgs e)

    {

    //If the button is clicked perform the following actions:

    //Retrieve the login to determine the USERID

    AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

    WindowsPrincipal user = (WindowsPrincipal)System.Threading.Thread.CurrentPrincipal;

    //Create a new OrderBy recordset

    OrderBy_WS OrderByRset = new OrderBy_WS();

    //Fill in the new OrderBy recordset with the data read with this key

    OrderByRset = OrderByService.Read(

    user.Identity.Name.Substring(user.Identity.Name.LastIndexOf('\\') + 1), 50002);

    //If there is no record in the OrderBy table then create new one

    if (OrderByRset == null)

    {

    OrderBy_WS OrderByRsetCreate = new OrderBy_WS();

    //Set the values for a brand new OrderBy record

    OrderByRsetCreate.User_ID = user.Identity.Name.Substring(

    user.Identity.Name.LastIndexOf('\\') + 1);

    OrderByRsetCreate.Page_NoSpecified = true;

    OrderByRsetCreate.Page_No = 50002;

    OrderByRsetCreate.OrderByInt = OptChoice;

    OrderByRsetCreate.SortOrder = SortChoice;

    //Create the NAV OrderBy table record with the key and sort order selected

    OrderByService.Create(ref OrderByRsetCreate);

    //Flush the OrderBy record after doing the create

    OrderByRsetCreate = null;

    }

    else

    {

    //Change the value of the fields OrderByInt and SortOrder in the new OrderBy recordset

    OrderByRset.OrderByInt = OptChoice;

    OrderByRset.SortOrder = SortChoice;

    //Update the NAV OrderBy table record with the new key and sort order selected

    OrderByService.Update(ref OrderByRset);

    }

    //Flush the OrderBy record

    OrderByRset = null;

    //Retrieve the record in the right sort order by using the SETCURRENTKEY statement

    // that you find in the Customer Page into the SetPageKey function

    RetrieveRecords();

    }

    }

    }

     

    7. Run the WinForm by pressing F5 and play with Key selection and Sort order dynamically with your brand new Customer WinForm!

    These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

    Best Regards,

    Duilio Tacconi (dtacconi)

    Microsoft Dynamics Italy

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    Converting company names for NAV Web Services

    • 0 Comments

    A few weeks ago I saw an up tick in the number of cases having problems accessing exposed web service. Some of the problem has been because the “CRONUS USA, Inc.” company name converts to an unfamiliar “CROUNS_USA_x002C__Inc”. This will be changing in NAV 2009 SP1, but until that time it would be helpful to know exactly how company names are converted for NAV Web Services. The rules are:

    The character '%' are converted to the word “Percent”.

    The characters '@', '"', '.', '/', '(', ')', '\', '-', ' ' (blank space) are converted to “_” with the following two additional rules.

    - no two succeeding “_”’s
    - no trailing “_” 

    This covers most cases and only applies when replacing the above characters, not with the following "special characters".

    Any remaining “special characters” are converted to “a valid XML name” (basically a numeric value, for example, the ampersand ‘&’  are converted to “_x0026_”). When a "special character" is converted like this, you could have two succeeding underscores ('_').

    List of known special characters (please update as needed.):

    • The ampersand ‘&’  are converted to “_x0026_”
    • The comma ',' is converted to “_x002C_” (i.e. 'CRONUS USA, Inc.' would be converted to 'CRONUS_USA_x002C__Inc')

    Additional, the How-To “Use SystemService to Find Companies” in the NAV 2009 Developer and IT Pro Documentation explain how to call the Companies operation on the SystemService to list the available companies with the converted names.

    Scott Wright (scowri)

    Microsoft Dynamics North America

    Microsoft Customer Service and Support (CSS) North America

Page 1 of 1 (13 items)