Microsoft Dynamics NAV

Team Blog

  • Microsoft Dynamics NAV Team Blog

    Transfooter and Transheader functionality in RDLC(SSRS) reports

    • 3 Comments

    Please note that I have posted a new blog for this subject here. /Claus Lundstrøm

    In our Classic reports we have the possibility to use Transfooter and Transheader. A typical use for classic Transfooters and Transheaders are to show a current subtotals up to the end of the current page or sums per page

    These functions are not directly mapped from Classic reports to RDLC reports in Dynamics NAV 2009, but in this post I will go through how this is done in RDLC reports:

    1. Create new report blank report with table 18

    clip_image001

    2. Create DataItem ”Customer”

    clip_image002

    3. Go to Section Designer and add the following fields:

    · No.

    · Name

    · Debit Amount

    clip_image003

    4. Save the report as ID 50000 – Transfooter / Transheader

    clip_image004

    5. Now go to Visual Studio (View / Layout)

    clip_image005

    6. Create table and add the fields No, Name and Debit Amount

    clip_image006

    7. Give this table the name “MainTable”

    clip_image007

    8. Now we have added the basic for this report. But I would also like to have a Grand total of the Debit Amount so I add this as well. I add this in the Footer of the table

    ="GrandTotal: " & sum(Fields!Customer__Debit_Amount_.Value)

    clip_image008

    9. Now if my report is printed I get a list of my all my customer with Debit Amount displayed and with GrandTotal in the end of the report:

    clip_image009

    10. Now I would like to see the accumulated sum of the Debit Amount on each the page footers, and on the next page display this accumulated sum from previous page. So I will add Transfooter and Transheader functionality to the report.

    11. First we need to do some intermediate calculations to accomplish this.

    Add 3 new columns to the existing table in Visual Studio;

    clip_image011

    12. In the first column enter this expression:

    =RunningValue(Fields!Customer__Debit_Amount_.Value, Sum, "MainTable")

    And give this name “Subtotals1”

    clip_image012

    13. In the Second column enter this expression:

    =RunningValue(Fields!Customer__Debit_Amount_.Value, Sum, "MainTable") - Fields!Customer__Debit_Amount_.Value

    And give this name “Subtotals2”

    clip_image013

    14. In the Third column enter this expression:

    =RunningValue(Fields!Customer__No__.Value, Count, "MainTable")

    And give this name “SubCount”

    clip_image014

    The 3 columns should now look like this:

    clip_image015

    15. As these 3 columns are only used for calculation I will make them really small and set Visibility “Hidden=True” and make the font red so I remember that these columns are hidden.

    Your report should now look like this:

    clip_image016

    16. Ok, it’s now time to add a Transfooter and Transheader. Enable Page Header and Page Footer in the report. You report should look like this:

    clip_image018

    17. In the Page Footer I place a text box with the following expression:

    ="Transfooter subtotal = " & Last(ReportItems!Subtotals1.Value)

    And then I set BackgroundColor, and Color just so this Transfooter stands out in my report, and right align text:

    clip_image019

    clip_image020

    18. In the Page header I place a text box with the following expression:

    ="Transheader subtotal = " & (First(ReportItems!Subtotals2.Value))

    And then I set BackgroundColor, and Color just so this Transfooter stands out in my report, and right align text:

    clip_image021

    clip_image022

    19. Now I’m almost done but I would like to not see the Transheader on the first page and not to see the Transfooter on the last page, so I select properties on the Page Header and set the “PrintOnFirstPage=False”

    clip_image023

    20. Now I could do the same on Page Footer, but maybe I would like to display the Page Footer, but not with the Transfooter displayed, so here is a little trick for how to do this.

    21. Insert a text box below the table and set the expression to “=True”, Name=LastPageControl, Hidden=True and color red.

    clip_image024

    22. With this field added after the table we can now check to see when we are on the last page.

    So I add the following Visibility Expression on the Transfooter textbox:

    =ReportItems!LastPageControl.Value

    clip_image025

    23. Now I’m done, I save, import into NAV and compile. After some fit and finish on the report it now looks like this when I print:

    clip_image027

    clip_image029

    You can download my report here as FOB and XPS.

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

  • Microsoft Dynamics NAV Team Blog

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

    • 0 Comments

    Our final update to the Microsoft Dynamics NAV 2009 Developer and IT Pro Help has been published on MSDN and the Microsoft Download Center. You can download the updated .chm file and copy it into your NAV 2009 installation to update the Help you receive from F1. The cumulative changes to the Help are available on the What's New page.

    Some of the new and updated content areas for this release include:

     As always, let us know what you think, what's missing, what's helpful, and what you like and dislike about Help.

    - Bob, Jill and John (the writers for NAV Developer and IT pro Help)

  • Microsoft Dynamics NAV Team Blog

    Microsoft Dynamics NAV 2009 SP1 installation moment...

    • 7 Comments

    Recently i met customer problem where NAV 2009 SP1 components didn't work after "correct installation".

    Problem is: customer installs NAV 2009 SP1 components by run msi file - for example "Microsoft Dynamics NAV SDK.msi". But this way doesn't install "Prerequisite Components" needed by NAV 2009 SP1. And it could be these installed NAV components will not work (because it missing prerequisites).


    Only supported way to Install NAV 2009 SP1 components is - run "setup.exe".

    However "setup.exe" will uninstall previous NAV version and installs new NAV 2009 SP1 version. If you need to have few NAV version installed - you need to run msi (instead of setup.exe).
    So conclusion: both ways have it strength and weakness. You can choose what you want, just you need to know about possible issues...

    Gedas Busniauskas (gediminb)
    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    Platform Update 2 for Microsoft Dynamics NAV 5.0 SP1

    • 6 Comments

    Update 2 for Microsoft Dynamics NAV 5.0 SP1 incorporates over 40 hotfixes and resolves various additional known issues reported since the previous update. It is verified to run on Windows 7 and on Windows Server 2008 R2. It provides updated stylesheets to support export of PictureBoxes to Microsoft Office Word and Excel. See the Release Notes provided with the update for details.

    Platform Update 2 for Microsoft Dynamics NAV 5.0 SP1 

    A CustomerSource login is required. Scroll down to the Downloads section of the page. For the selected country, click the link in the Platform Update 2 column.

  • Microsoft Dynamics NAV Team Blog

    Export of Pictures using Send-To MS Word/Excel functionality

    • 3 Comments

    With release of update 2 for NAV 5.0 SP1, the client now supports exporting picture box using style sheets (send-to Word/Excel) functionality.

    Both Client and style sheets have been modified to align with this change. If you don't normally have picture fields on the form you're exporting, you would add the field through codeunit 403, where additional data is normally added to the export (runtime). For simplicity I added a PictureBox contatining Picture field to Item form - and that is all there is to it really. When using send-to functionality, generated output will show item picture in the document. Now testing this with export to Word, one might note the crossed icon if the picture is not available. Though that should not be an issue either, modifying the style sheet to ignore the control if data is not present, should this really be necessarry, is as simple as a single if-test.

    So to illustrate this, I've changed the following part of NavisionFormToWord style sheet (changed lines marked with comments), to add an if test around 'pict'-  tag, and


        <xsl:if test="@data != ''"> <!-- IF TEST BEGIN !-->
              <w:pict>
                <w:binData xml:space="preserve"><xsl:attribute name="w:name">wordml://<xsl:value-of select="@id"/>.png</xsl:attribute><xsl:value-of select="@data"/></w:binData>
                <v:shape id="_x0000_i1025" type="#_x0000_t75">
                  <v:imagedata o:title="CRONUS">
                    <xsl:attribute name="src">wordml://<xsl:value-of select="@id" />.png</xsl:attribute>
                    <xsl:attribute name="o:title"><xsl:value-of select="@name" /></xsl:attribute>
                  </v:imagedata>
                </v:shape>
              </w:pict>
        </xsl:if>   <!-- IF TEST END !-->

    Note that this is even easier if we're controling field export through coudeunit 403, where this test can be implemented instead, to control availability of the control based on data content.

    Jasminka Thunes 

    Microsoft Norway

    Microsoft Customer Service and Support (CSS) EMEA

     

     

  • Microsoft Dynamics NAV Team Blog

    Simple! Client Extensibility example

    • 4 Comments

    There is a number of posts and articles that show what you can really achieve with Client Extensibility in NAV 2009 SP1. This post goes the exact opposite way, to show the simplest possible example of a Client Extensibility add-in which includes callbacks between RTC and the Add-In, both ways:

    In Visual Studio, add references to Microsoft.Dynamics.Framework.UI.Extensibility, System.Windows.Forms and (just to add colours) System.Drawing.

    To add the first one, browse for "Microsoft.Dynamics.Framework.UI.Extensibility.dll" which is in the RTC folder. The other references used here are both under ".NET":

     

    References

    Then you need to sign the project. In Visual Studio 2008, under Project Properties, go to the Signing tab, tick "Sign the Assembly", and create a new key (type anything as the key name).

    And here is the code needed to create a simple add-in, in this example just a button:

     

     

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using Microsoft.Dynamics.Framework.UI.Extensibility;

    using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;

    using System.Windows.Forms;

    using System.Drawing;

    namespace zDemo

    {

    [ControlAddInExport("zDemo")] // Interface - this is the name that is registered in NAV

    public class zDemoButton : StringControlAddInBase

    {

    // Initialise what you want to create, then return it to RTC

    protected override Control CreateControl()

    {

    Button B = new Button();

    B.BackColor = Color.LemonChiffon; // Just so it stands out in the page

    B.Click += this.OnButtonClick; // This is needed for calling NAV trigger (function below)

    return (B);

    }

    // No other code is needed to create the add-in,

    // But if you also want to exchange data between the add-in and NAV, then continue

    // Receive data from NAV

    public override string Value

    {

    get

    {

    return base.Value;

    }

    set

    {

    if (Convert.ToString(value) != "")

    {

    ((Button)this.Control).Text = Convert.ToString(value);

    }

    }

    }

    // Run NAV trigger OnControlAddIn

    private void OnButtonClick(object sender, System.EventArgs e)

    {

    this.RaiseControlAddInEvent(1, "Button");

    }

    }

    }

     

    Finally build the project. Copy your new dll and pdb file into the add-ins sub folder of RTC. Use the syntax sn -T [MyNewDll] from a Visual Studio command prompt to get the Public key token from your new dll. Register it in table 2000000069 "Client Add-in" with its name and Public key token, then add it to a page. To send data to the add-in, you also need to specify the "SourceExpr"-property. This can be either a variable or a field. In this case, it will just display the source expression on the button.

    For the purpose of keeping this post minimal, I won't go into any further details here, but I will mention one thing: I found that this line:

    if (Convert.ToString(value) != "")

    is important. It seems that some times, the page calls the add-in multiple times, and some times with a blank value. So if not testing that RTC has actually sent some data to the add-in, you may be overwriting with blank data, and you may spend time to work out why this part is not working.

     

     

    Lars Lohndorf-Larsen

    Microsoft Dynamics UK

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    SQL Server Trace Flag 4616 no longer required for Dynamics NAV 5.0 SP1 or Dynamics NAV 2009 SP1

    • 3 Comments

    Starting with Dynamics NAV 4.0 SP3 build 24080, all builds of NAV (SQL option) have a prerequisite that SQL  Server trace flag 4616 must be turned on. This was initially required when running NAV with SQL Server 2005 but subsequently was also required for SQL Server 2008 when that became a supported database platform.

    Why did we need this trace flag? SQL Server 2005 introduced increased security protection for database metadata which means that visibility is restricted by default for users in such a way that they can no longer see connection details for other logins unless the user is granted “VIEW SERVER STATE” permissions. However, Dynamics NAV licensing functionality and the client feature for displaying database sessions both required that users must have visibility to all active connection details. SQL Server trace flag 4616 causes SQL Server 2005 and 2008 to behave in the same way as SQL Server 2000 with respect to metadata visibility. Therefore, when support for SQL Server 2005 was added to the Dynamics NAV product the requirement to turn on trace flag 4616 was also introduced.

    Why do we no longer need this trace flag? With the release of Dynamics NAV 5.0 SP1 (Update 2 build 30488 or later) and Dynamics NAV 2009 SP1, trace flag 4616 is no longer required. These versions of the product now uses “VIEW SERVER STATE” permissions to enable visibility to the required connection information for each user.

    For customers who have been using SQL Server trace flag 4616 for older versions of Dynamics NAV Microsoft recommends disabling this trace flag after upgrading to either Dynamics NAV 5.0 SP1 (Update 2 build 30488 or later) or Dynamics NAV 2009 SP1. Most environments will have this trace flag added to the startup parameters for SQL Server so the following steps can be used to remove it as required:

    1. Go to Start-> Run and select the "Microsoft SQL Server 2005/2008" program group, select the "Configuration Tools" folder and then the "SQL Server Configuration Manager" tool.

    2. Double-click on the SQL Server service.

    3. Select the "Advanced" tab

    4. In the list of values double-click on the one called "Startup Parameters"

    5. In the list of values for this parameter (normally near the end), remove the following: ';-T4616'

    6. Click OK to save the change.

    7. Restart the SQL Server service

    Before removing trace flag 4616 from your SQL Server environment please verify that no other database applications are depending on this feature.

    In some rare cases the trace flag may be enabled on SQL Server using some other means (e.g. DBCC TRACEON command). Consult your SQL Server database administrator for advice in these scenarios.

    Best regards,

    Gerard Conroy

    Microsoft Dynamics NAV Support, UK

  • Microsoft Dynamics NAV Team Blog

    More Charts

    • 9 Comments

    This is a follow up to this post:

    Using Client Extensibility in NAV 2009 SP1 to create Charts

    News in this post are:

    2-series line charts. For example showing number of new Orders and Quotes for the last 10 days:

    2SeriesChart

    Item Sales Chart (basically identical to the Customer Sales Chart in the previous post):

    ItemSales

    Doughnut charts have been shined up a bit to make them look better:

    Don

    Double-click callback to NAV: When you double-click a chart, it will call the ControlAddin trigger. The example below will open up a list of Cust. Ledger Entries when double-clicking on a chart on the Customer Card page:

    Sales (LCY) - OnControlAddIn(Index : Integer;Data : Text[1024])
    CustLedgEntry.SETCURRENTKEY("Customer No.");
    CustLedgEntry.SETRANGE("Customer No.","No.");
    PAGE.RUN(0,CustLedgEntry);

    All you need is attached at the end of this post. It contains .dlls, including their source code, and a NAV codeunit. To implement some examples:

    Implement the charts add-on:

    1)  If you want to modify the attached c# project you must install "Microsoft Chart Controls Add-on for Microsoft Visual Studio 2008".

    2)  On any client machine where you want to run the charts, you must install "Microsoft Chart Controls for Microsoft .NET Framework 3.5".

    3)  Detach and unzip the attached file.

    4)  From the unzipped file, copy the files from \XTCharts\bin\Debug\ into the "Add-ins" sub folder of the RoleTailored Client (RTC).

    5)  And import the codeunit from XTChart.fob in Object Designer.

    6)  In a Classic Client, run table 2000000069 "Client Add-in" and enter one line (if it doesn't already exists from the previous post):

    Control Add-in Name:    XTChart
    Public Key Token:    d1a25808afd603da

    (making sure to have exactly these values, in the right case)

    Adding charts to pages:

    On the page where you want a chart, insert a new line of type Field. In the property "ControlAddIn", select the XTChart (XTChart;PublicKeyToken=d1a25808afd603da). This adds the control itself. To send data to the control you must specify SourceExpression too. Declare a Global variable called XTChartUtil, Type = Codeunit, Sub Type = Codeunit 75550 "XT Chart Util" to use in SourceExpression. If the chart is on a Customer Card page, then specify this SourceExpression:

    For a line-chart, showing "Sales (LCY)" for the last 6 months:  XTChartUtil.CustPointsChart(Rec)

    For a Doughnut chart, showing "Balance (LCY)" percentage of "Credit Limit": XTChartUtil.CustDoughnutChart(Rec)

    On an Item Card page, for a line chart showing Item "Sales (LCY)" for the last 6 months, have SourceExpressions XTChartUtil.ItemPointsChart(Rec)

    On the main Role Centre, to have a 2-series chart showing number of Quotes and Orders created in the past 10 days, I added the chart in Page 9060 with this SourceExpression: ChartUtil.SalesCueChart

    Then, for each example above, if you want to trigger any activity when the user double clicks the chart, just put some C/AL code on the corresponding OnControlAddIn-trigger.

    You can add charts in many other places, except for pages of the following types which cannot handle Extensibility components:

    • Under a Repeater Control (i.e. a list page)
    • Action Pane
    • Command Bar
    • Filter Pane

    Note:

    In the example here, I added a chart to the main Role Centre. In a production environment this is maybe not such a good idea, for these two reasons:

    1)  If a chart goes wrong and crashes, for example if a user has not installed the Chart Controls for .NET (link above), then it may crash the whole RTC. If this happens from some page which shows a chart, then at least the user knows that such and such page has a problem. If it happens on the Role Centre, then RTC will crash as soon as it is opened, and the user cannot use RTC at all, and it may not be obvious why RTC crashes.

    2)  Performance is not great in the SalesCueChart-example here, counting Sales Header records filtering on "Document Date". If a company has 1.000s of orders, then this would have some impact on performance. So, at least only calculate the chart on request, and not on the main page whether the user actually needs it or not.

    Development notes

    If you want to extend this to create new charts, then this is how the attached example works:

    Chart Data is generated in xml format in codeunit 75550 "XT Chart Util". It has a function for each type of chart. The xml data must have this format:

    - <Chart>

    <ChartType>1</ChartType> <-- Chart Type 1 = Lines, 2 = Doughnut and 3 = 3D lines

    - <Data Title="Orders"> <-- Title is optional. If specified, it will show as legend on the chart

    <REC1 Title="16/01/11">0</REC1> <-- Name the elements REC1, REC2, etc.

    <REC2 Title="17/01/11">2</REC2>

    <REC3 Title="18/01/11">0</REC3>

    <REC4 Title="19/01/11">2</REC4>

    </Data>

    - <Data2 Title="Quotes"> <-- Data2 section is optional. Used for making 2-series charts. If there is a Data2 section, then it must have the same number of elements as Data, and with the same names.

    <REC1 Title="16/01/11">0</REC1>

    <REC2 Title="17/01/11">0</REC2>

    <REC3 Title="18/01/11">0</REC3>

    <REC4 Title="19/01/11">1</REC4>

    </Data2>

    </Chart>

    In case of a Doughnut chart, just generate an xml document like this:

    - <Chart>

    <ChartType>2</ChartType>

    - <Data>

    <REC1 Title="Balance">9.20</REC1>

    <REC2 Title="CreditLimit">90.80</REC2>

    </Data>

    </Chart>

    with 2 REC-elements which total up to 100.

    The c#-code is all inside of one big try{} catch{} - structure. If anything goes wrong, then it will just show the data that was received in a MessageBox, but not what actually went wrong. Only if you remark the try{} and catch{} - section, it will throw the actual error message to tell you what went wrong (it should log it in the Application log). But the downside of this is, that RTC is also likely to crash.

    Lars Lohndorf-Larsen

    CSS EMEA

    This posting is provided "AS IS" with no warranties, and confers no rights

  • Microsoft Dynamics NAV Team Blog

    NAV 5.0 Help Source Files for Turkey and Greece Released

    • 0 Comments
    With the recent release of the Microsoft Dynamics NAV 5.0 Help source files for Turkey and Greece, we have now released the Help source files for all Microsoft Dynamics NAV 5.0 countries. If you are creating a solution for those countries, you can modify the Help source files to reflect your customizations of  Microsoft Dynamics NAV 5.0. You can download the files here.

    As always, let us know what you think about the Help, the customization process, the tools, what's missing, and what would be more helpful. Send your feedback to navhelp@microsoft.com.

  • Microsoft Dynamics NAV Team Blog

    Overview Pages of Released Application Hotfixes for Microsoft Dynamics NAV 5.0 SP1, Microsoft Dynamics NAV 2009, and Microsoft Dynamics NAV 2009 SP1

    • 1 Comments

    Overview pages of released application hotfixes for Microsoft Dynamics NAV 5.0 SP1, Microsoft Dynamics NAV 2009, and Microsoft Dynamics NAV 2009 SP1 are available on PartnerSource and CustomerSource under Support, Self Support, Hot Topics at the following links:

    PartnerSource:

     

    Overview of Released Application Hotfixes for Microsoft Dynamics NAV 5.0 SP1

     

    Overview of Released Application Hotfixes for Microsoft Dynamics NAV 2009

     

    Overview of Released Application Hotfixes for Microsoft Dynamics NAV 2009 SP1

     

     

    CustomerSource:

     

    Overview of Released Application Hotfixes for Microsoft Dynamics NAV 5.0 SP1

     

    Overview of Released Application Hotfixes for Microsoft Dynamics NAV 2009

     

    Overview of Released Application Hotfixes for Microsoft Dynamics NAV 2009 SP1


    The overview pages list application hotfixes released after January 1, 2010.

    Links to platform hotfix overview pages can be found here: Overviews of Released Platform Hotfixes for Microsoft Dynamics NAV 5.0 SP1, Microsoft Dynamics NAV 2009, and Microsoft Dynamics NAV 2009 SP1

     

  • Microsoft Dynamics NAV Team Blog

    Using Client Extensibility in NAV 2009 SP1 to create Charts

    • 7 Comments

     

    Just to get a bit of practice with Client Extensibility, I experimented with some examples I got. They use MS chart controls to build chart

    components for RTC. As it turned out, the result was something that might even be useful as well. So this post has these two

    purposes: 1)  Some relatively simple examples of Client Extensibility, and 2)  hopefully in the process to make something that can

    actually be useful.

     

    Of course - as always - the information in this post is un-supported and no responsibility is assumed. In particular when working with

    Client Extensibility add-ons, one has to be careful of handling any potential error in the add-on. If the add-on meets an unhandled exception,

    then RTC may crash. So if you decide to extend the example here (and I hope you do), then just be careful to trap as many potential

    exceptions as possible in your Visual Studio code. This is lesson one for creating Client Extensibility Add-ins...

     

    However I would encourage any feedback - just post it here at the end of this post. Is this useful, what else would be useful, etc. Both

    for learning this new technology, and I would also welcome any ideas for charts that might be useful.

     

    Also check these links for much more information on Client Extensibility:
      Christian's blog
      Extending the RoleTailored Client Using Control Add-ins in Microsoft Dynamics 2009 SP1

     

    New blogs on this topics may follow - all depending on the response to this one. For now, this post shows how to achieve two different types of charts, looking like this:

     

     

    CustPage

      

    Making charts with Clients Extensibility for NAV 2009 SP1 using the "Microsoft Chart Controls add-on for MS Visual Studio"

    First, you need to download and install these two components:

    Microsoft Chart Controls Add-on for Microsoft Visual Studio 2008

    Microsoft Chart Controls for Microsoft .NET Framework 3.5

     

    Then from here you can take the easy way and just use the completed project that I attached at the end of this post. Or the hard way, and follow the full directions below. First, if you just want to see what this is, here is how to implement this example from the files attached here:

     

    Implement the Client Add-in control:

    As the name suggests, Client Extensibility add-ons run on the client (RTC). In NAV 2009 SP 1, the RTC folder contains a new subfolder called "Add-ins" (default C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client\Add-ins). So unzip the attached file "XTCharts.zip", then copy the files from "XTCharts\bin\Debug\" into the Add-ins subfolder in RTC.

    Next, open a Classic Client and "Register" this add-in for the client: Run table 2000000069 "Client Add-in", and enter a new line:


    Control Add-in Name:    XTChart
    Public Key Token:    d1a25808afd603da

    It's important that you call it exactly this, since both the Add-in Name and the Public Key Token refer to these specific dlls (explained further below).

    This example includes codeunit 75550 "XT Chart Util" which has functionality generating the data that the charts are based on. So import XTChart.fob.

    Finally, add a chart control to a page. For this example add it to page 21 "Customer Card": In Page Designer, first create a new global variable called XTChartUtil, Type = Codeunit, SubType = XT Chart Util. To add the line-chart:

    add a new line called "Sales (LCY)" of type "Field", and specify these two properties:

    SourceExpr = XTChartUtil.CustPointsChart(Rec)

    ControlAddIn = XTChart;PublicKeyToken=d1a25808afd603da

    And to add the pie-chart, add a new line with these proerties:

    SourceExpr = XTChartUtil.CustDoughnutChart(Rec)

    ControlAddIn = XTChart;PublicKeyToken=d1a25808afd603da

    Save and compile the page, then start RTC, and the Customer Card page should now look as in the picture above.

     

    What this example gives, is: 1) A chart showing "Sales (LCY)" for the last 6 months, and a doughnut chart that shows the percentage of Balance compared to Credit Limit.

    Designing the client Add-in control:

    Hopefully by following the steps above, you should now have charts on your Customer Card. So here is how you would have designed it from scratch instead of using the attached example.

    To get started, open up Visual Studio 2008. Create a new project of type Class Library. In the project that opens, in the Solution Explorer, right click References, and select "Add Reference...". Here we need to add a few references:

    From the "Browse" tab, browse to the folder where you have Dynamics NAV RoleTailored Client installed (default C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client), and select Microsoft.Dynamics.Framework.UI.Extensibility.dll. This is the library that is always needed when making a Client Extensibility add-on.

    Add another reference, this time from the ".NET" tab select System.Windows.Forms.DataVisualization. This is the library that you installed from the links above. And, finally, also from the ".NET" tab, add System.Windows.Forms

    Also add references to these in code, like this in the top:

    using System.Windows.Forms.DataVisualization.Charting;

    using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;

    using Microsoft.Dynamics.Framework.UI.Extensibility;

    using System.Windows.Forms;


     

    And now you are ready to start using functionality from Client Extensibility, and from Microsoft Chart Controls.

    To start any Client Add-in control, you need two things:

    [ControlAddInExport()]-declaration just before the class you make, and

    protected override Control CreateControl() which is the function that RTC runs when initialising a Client Extensibility Add-in. Your project should now look like this:

     

     

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Windows.Forms.DataVisualization.Charting;

    using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;

    using Microsoft.Dynamics.Framework.UI.Extensibility;

    using System.Windows.Forms;

    namespace ClassLibrary8

    {

    [ControlAddInExport("XTChart")]

    public class XTChartClass : StringControlAddInBase

    {

    protected override Control CreateControl()

    {

    Chart XChart = new Chart();

    return (XChart);

    }

    }

    }

     

    You must remember the name you decide on, in this line:

     [ControlAddInExport("XTChart")

    This is the name (XTChart) that must match the entry in table 2000000069 "Client Add-in".

    This is the minimum code needed - you can of course now also specify a number of properties for your chart control, like colours, chart types, etc. As long as you create your control here, and then return it back to RTC.

    The next question is: how do we send data from RTC to our control? This done by adding these lines:

    public override string Value

    {

    get

    {

    return base.Value;

    }

    set

    {

    base.Value = value;

    }

    }

     

    This is the Value that you get from RTC. RTC sends it via the SourceExpression of the Control Add-in when you add it to a page. When you add an Add-in to a page you don't have to specify SourceExpression, but if you want to send data from RTC to the Add-in, then this is how to do it. In this example there is a codeunit to generate chart-data, but SourceExpression can also just be a field.

    In the section you just created, you can now refer to the chart like this: 

    ((Chart)this.Control)

    So when receiving data from RTC, you can then set ChartType, Data, and any other properties on the chart.

     

    You must also sign the project: In Project Properties, on the "Signing"-tab, you must tick "Sign the assembly". This embeds a public key token in the .dll when you build it, and this is the token (here d1a25808afd603da) that must also be entered into table 2000000069. Visual Studio does not tell you what the token is, so to obtain it, after building your project open a Visual Studio Command Prompt, and run "sn -T XTCharts.dll" to find out what the public key token is for XTCharts.dll.

     

    In this example, we send an XML structure to the Add-in, which is generated by the codeunit. The structure is like this:

    - <Chart>
        <ChartType>2</ChartType>
    - <Data>
        <Aug>446.04</Aug>
        <Sep>334.53</Sep>
        <Oct>0</Oct>
        <Nov>111.51</Nov>
        <Dec>501.8</Dec>
        <Jan>1,499.02</Jan>
    <</Data>
     </Chart>
     
     So basically, we have one node for the Chart Type (1 is for a point-chart, and 2 is for a doughnu chart). And then there is a data-section for the Series in the chart.
     
    Finally, in the code below, also notice these lines:

    try { - do code..}

    catch{MessageBox.Show("An error occurred ");}

     
    I am not a c# developer, so this way of doing error handling is likely not optimal. But if any kind of error happens in the code, and it is not inside of a try{}-structure, then the Add-in may crash, and when that happens, RTC will also crash. In this example, instead of a crash, we would get a message and RTc would stay open.
     
     
    So, below is the whole code from the attached example. Remember this particular code is designed specifically receive data in a specific format, done by the attached codeunit. So it can of course be simplified, or of course even more so, it is something that can be improved on.
     
     
     
    Again, I hope this is useful for getting insight into Client Extensibility, but also maybe it can be used as a basis for making some useful components - comments are more than welcome,
     
    Best regards
    Lars
     
     
     
     
     
     
    Full code:
     

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Windows.Forms.DataVisualization.Charting;

    using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;

    using Microsoft.Dynamics.Framework.UI.Extensibility;

    using System.Windows.Forms;

    using System.Drawing;

    using System.Xml;

    namespace XTCharts

    {

    [ControlAddInExport("XTChart")]

    public class XTChartClass : StringControlAddInBase

    {

    protected override Control CreateControl()

    {

    Chart XChart = new Chart();

    XChart.Series.Add("Series1");

    XChart.ChartAreas.Add("Default");

    XChart.Width = 100;

    XChart.Height = 100;

    return (XChart);

    }

    public override string Value

    {

    get

    {

    return base.Value;

    }

    set

    {

    try

    {

    if (Convert.ToString(value) != "")

    {

    ((Chart)this.Control).Series["Series1"].Points.Clear();

    String TempXML = value;

    XmlDocument XMLDoc = new XmlDocument();

    XMLDoc.LoadXml(TempXML);

    // Chart Type

    XmlNode Node = XMLDoc.SelectSingleNode("Chart/ChartType");

    switch (Convert.ToString(Node.InnerText))

    {

    case "1":

    ((Chart)this.Control).Series["Series1"].ChartType = SeriesChartType.Spline;

    ((Chart)this.Control).BackColor = Color.AliceBlue;

    break;

    case "2":

    ((Chart)this.Control).Series["Series1"].ChartType = SeriesChartType.Doughnut;

    break;

    default:

    MessageBox.Show("Invalid ChartType " + Convert.ToString(Node.InnerText));

    break;

    }

    // Chart Data

    XmlNodeList Nodes = XMLDoc.SelectNodes("Chart/Data/*");

    for (int i = 0; i < Nodes.Count ; i++) {

    Node = Nodes.Item(i);

    ((Chart)this.Control).Series["Series1"].Points.AddXY(Node.Name, Convert.ToDouble( Node.InnerText));

    }

    }

    }

    catch{MessageBox.Show("Error with data from NAV " + value);}

    }

    }

     

     

    }

    }

     
     
  • Microsoft Dynamics NAV Team Blog

    Upgrade Toolkit Quick Guides Revised for Microsoft Dynamics NAV 2009 SP1

    • 2 Comments

    The Upgrade Toolkit Quick Guides provide detailed roadmaps for moving your applications from earlier versions of Microsoft Dynamics NAV to Microsoft Dynamics NAV 2009 SP1. There are four Quick Guides:

    • Upgrade Quick Guide 370_2009SP1.doc: For upgrading from Microsoft Dynamics NAV 3.7 to Microsoft Dynamics NAV 2009 SP1.
    • Upgrade Quick Guide 400_2009SP1.doc: For upgrading from Microsoft Dynamics NAV 4.0 to Microsoft Dynamics NAV 2009 SP1.
    • Upgrade Quick Guide 500_2009SP1.doc: For upgrading from Microsoft Dynamics NAV 5.0 to Microsoft Dynamics NAV 2009 SP1.
    • Upgrade Quick Guide 2009_2009SP1.doc: For upgrading from Microsoft Dynamics NAV 2009 to Microsoft Dynamics NAV 2009 SP1.

    To get the Quick Guides, scroll down to "Upgrade Toolkit Quick Guides" on the Microsoft Dynamics NAV 2009 Service Pack 1 (SP1) page on PartnerSource and click Download Here.  A PartnerSource login is required. All four Quick Guides are included in a single compressed file: UpgradeQuickGuides_2009SP1.zip.

  • Microsoft Dynamics NAV Team Blog

    Changes Document Now Available

    • 3 Comments

    The Changes document for Microsoft Dynamics NAV 2009 SP1 is now available on Partnersource. With this release, we are trying out a new format and would like to hear your feedback on the following:

    • Does the format work for you?
    • Does this Changes document provide you with the information you expect?
    • Does this Changes document provide you with the information you need?

    Add your feedback in the comments below.

    You can download the document from the following location:  Changes Made In Microsoft Dynamics NAV 2009 SP1. Log in to Partnersource is required.

  • Microsoft Dynamics NAV Team Blog

    NAV 2009 SP1 Help Source Files for Belgium, Sweden, and Norway Released

    • 1 Comments

    With the recent release of Microsoft Dynamics NAV 2009 SP1 for Belgium, Norway, and Sweden, we have now released the Help source files for those countries. If you are creating a solution for those countries, you can customize the Help source files to match your solution. You can download the files here.

     

    In addition, we have re-released the Help source files for all Microsoft Dynamics NAV 2009 SP1 countries to add a file that contains translated boilerplate text. You can download the updated source files here. Finally, we’ve re-released the Microsoft Dynamics NAV 2009 SP1 Help Toolkit with updated documentation on creating customized Help. You can download the updated toolkit here. (Note that PartnerSource access is required for all downloads.)

     

    As always, let us know what you think about the Help, the customization process, the tools, what's missing, and what would be more helpful. Send your feedback to navhelp@microsoft.com.

  • Microsoft Dynamics NAV Team Blog

    How would I use RIM and Style Sheet Tool to handle change of Tax Number (OiB) in Croatia (Part 3 of 3)

    • 0 Comments

    In part 1 of this series, I described the problem of the tax numbers in Croatia being changed. In part 2, I described how to export data that you need from NAV and use that data to request new tax numbers from customers, vendors sand contacts. In this post, I will describe how to update the data with new tax numbers and import it into Dynamics NAV.

    Update new tax number data received from customers, vendors and contacts

    When you receive documents with new tax numbers (OiB) from customers, vendors and contacts, you can update excel file you created in first step with it. You should update VAT Registration No. field in Excel file in Customer, Vendor and Contact worksheets.

    After you're finished updating data and are satisfied with it it's time to import it back to Dynamics NAV.

    First, make sure that new tax number validation rules are set in Dynamics NAV. You can do this following these steps:

    1. In Microsoft Dynamics NAV, on the main menu, click Administration, Application Setup, General, Countries/Regions to open the Countries/Regions form.

    ivan21

    2. Select Croatian record (code HR) and click Country/Region, VAT Reg. No. Formats to open HR - VAT Registration No. Formats form.

    ivan22

    3. Verify that 2 lines containing 11 pounds (# symbols) exist in the table, as new tax number in Croatia is formatted in a way that it contains 11 numeric characters.

    After this, you can proceed to importing data you prepared in excel file created in first step. You can do this following these steps:

    1. Click Application Setup-> Company Setup-> Data Migration in Administration application domain to open Migration overview form.

    2. Click Functions-> Import from Excel on Migration Overview form to import data from Excel file.

    3. When asked, select folder and Excel file from which to import data and click Open.

    4. System will import data and notify you when it's done.

    ivan23

    5. To verify that something was really imported, verify that No. of Migration Record is different from zero in Migration Overview form.

    6. If some errors occurred (like new tax number didn't comply to format set earlier), you can see this by clicking Drill Down button in No. of Migration Errors field in Migration Overview form.

    7. When all errors are removed (No. of Migration Errors is zero) for all lines you need to apply migration data. Select all lines, clicking Edit, Select All to select all lines in Migration Overview form

    8. Click Migration, Apply Migration Data to apply migration data

    9. To verify data was applied, verify that No. of Migration Record is zero in Migration Overview form

    10. Also, you may open any of your customer, vendor and contact records in the system and verify that VAT Registration No. field contains the value set in excel file.

    To make sure your VAT reporting will take VAT Registration numbers correctly have a look at these KB articles which describe a small modification needed to VAT Sales Book and VAT Purchase Reports to enable this.

    -Ivan Koletic

Page 35 of 51 (758 items) «3334353637»