Saturday, 29 December 2007

Happy New Year to you all!


Well it’s nearly the end of 2007 and I can’t let the year finish without wishing you all a Happy New Year! Thank you to everyone that has taken the time to subscribe to or read my blog over the last few months. I started this blog in April to help me learn to write. It’s been challenging but fun.

Since starting the blog, I’ve had over a 1000 visits from over 60 countries (see map). Incredibly I have not had a single comment posted. I guess I should not be surprised since I regularly read blog posts but rarely make a comment. If you read this, make a comment – even if it’s just to say “Hi”.

The most popular content by far has been my write up of Dynamics NAV 5.1 Reporting and Web Services. I took the time to review the video preview of the upcoming release and wrote what I saw and gave my opinion. This goes to show how much interest there is in the new version of Dynamics NAV (now codenamed as “6.0” but more than likely to be called “Dynamics NAV 2009.”)

I spent a lot of time researching and writing a series of postings on the new send-to-application feature in NAV 5.0. This exercise was time consuming and ultimately fruitless. It’s hard to know what to write about. I wanted this blog to be original and tried to avoid re-posting news from other sites or forums. I am still perplexed as to how you get your blog postings included in the Google Alerts for Dynamics NAV.

Probably the most satisfying moment was when the good people at PACKT publishing agreed to send me a free copy of David Studebaker’s book on programming Microsoft Dynamics NAV in return for a review posted on my blog and Amazon. I was really stoked to get something free from my blog. I am pleased with my book review but I don’t think David or Packt were that impressed.

2007 has been a tough year but I am looking forward to 2008. IT is a funny business, we’re always looking for the next big thing. I’m sure as soon as I get my hands on the new Dynanics NAV I’ll be wanting the next realease. One of the real highlights of my working year has been working with one of the industries real stars. Chommy Cash is a NAV and .NET programmer extrordinaire who is sadly leaving us to start an Alpaca farm in the Himalayas. Chommy, if you’re reading this (which I’m sure you won’t since you never read anything I write), I’ll miss you and wish you all the best for the future.

Enjoy your celebrations, and remember to add to your resolutions: “I must leave comments on the blogs I read.”

Tuesday, 11 December 2007

Test Drive Microsoft Dynamics NAV 5.0

This link came up on my Google Blog Search for Dynamics NAV:

http://www.dynamicsnavtestdrive.com/

By logging onto the test drive environment using your web browser, you will be able to experience Microsoft Dynamics NAV first hand without the need of installing it on your computer. You can explore the product on your own, or follow along guided exercises and demos.

Monday, 10 December 2007

Book Review: Programming Microsoft Dynamics NAV



Author: David Studebaker

Publisher: Packt Publishing

ISBN: 1904811744

Published: October 2007


This is currently the only book that covers programming Microsoft Dynamics NAV and that for most people will be a good-enough reason to buy it.

The book is intended to help reduce the time needed for non-NAV programmers to become productive with NAV’s unique programming language and development tools. From its coverage of terminology and basic concepts to advanced topics and techniques, this book is not just for the NAV-newbie; there is enough advanced content and good advice to prove useful for the seasoned NAV developer too. According to the preface, the book is also intended to help managers and those considering purchasing or enhancing the product to become familiar with the level of customisation the product can provide.

David Studebaker has been programming NAV since 1996 and, with over 40 years IT experience, he is well-qualified to write this book. He is currently a principal of a company that provides development, consulting, training and upgrade services for NAV resellers and firms using NAV. It is rare to get the opportunity to work with someone with such experience and this book may be the closest you’ll ever get to having a true veteran provide mentoring and advice.

Overall this is a good book, but it could have been a lot better. The publisher claims this is a “Fast-paced and to-the-point... [book with] …clear explanations and practical example code.” However, I found some of the early chapters rambling, slow and tedious with more than a handful of mistakes. The chapter on fields in particular contained a number of basic errors that should have been picked up by the proof reader or reviewers. At times I felt as though I was the first person to actually read this book.

Whilst David is clearly a very experienced NAV developer, he is not a great writer, so do not expect an easy read. Some explanations are long-winded and prone to tangential wanderings. It seems that, subconsciously at least, David is aware of his propensity to ramble when, after a 5-page-explanation of the “Date Formula” data type including a programming example, he writes: “It may seem that we overemphasized this experiment. But you got to see a lot more here than just date calculations.” A good editor could have helped us all at this point.

I really wanted to like this book and essentially I do. The content is undoubtedly good, so do not be put off by my criticisms. In value-for-money terms this book is exceptional: try to see how much consultancy or training time 60 US Dollars will buy you!

David has done a great job in completing this book and has obviously invested a lot of time for what must be a tiny market. If you work with NAV you should buy this book.

Monday, 26 November 2007

3-part Format String

I mentioned in the previous post that you could use a 3-part formatting string in the format property of your numeric field to display blank when the number is 0.

Here is an example of a 3-part format property setting. If you put this in the Format field:

="$#,###;($#,###);#"

Then this says:

  • When Positive use $#,### which is “Prefix with Dollar sign, blank when zero, comma thousands separator, no decimal places”
  • When Negative use ($#,###) which is “Same as positive but within brackets”
  • When 0 use # which is “Blank”.
This works quite nicely. Don't try using special characters like "C" for currency in your 3-part format string because this special character is itself interpreted as a 3-part string and you'll find it doesn't work.

Reporting Services Divide by Zero Error in Report Expression

It’s a real pain – if I have a field that I want to calculate as one field divided by another, I have found that I get a divide by zero error when one of the fields is 0.

Normally, I would do a quick check on the field I am dividing by (the divisor) before using it in a calculation. In a field expression, the only way to include this kind of check is with an inline if statement. So I would have something like this in my report expression:

=IIF(Fields!Budget.Value = 0, "", Fields!Budget.Actual / Fields!Budget.Value)

But there is a problem with this. The False part of the IIF function still gets evaluated and your field shows #Error instead of a blank as expected.

There is a really simple way around this – create your own VB.NET function and call this from within the expression. Creating a VB.NET function is really easy as long as you are playing nicely in the sandbox (i.e. not trying to access any of the machine’s resources.) Here is a sample function that you can paste into the Code property of the report:

Public Shared Function VarPercent(ByVal Actual As Decimal, ByVal Budget As Decimal) As Decimal
If Budget = 0 Then
Return 0
End If
Return (Actual / Budget)
End Function


To use the function, just put the following in your expression:

=code.VarPercent(Fields!Actual.Value,Fields!Budget.Value)

That’s it!

If the divisor is 0, we return 0. We could of course return an empty string – although you can just as easily do this by formatting the field using a formatting expression that shows blank for zeros.

Tuesday, 20 November 2007

Wasps: Are they really Yellow?

Ashely has written a great blog posting on the Intergen blog site titled Wasps: Are they really Yellow?

This reminded me of why I wanted to start blogging. I wanted to write and I thought that blogging was a good way to practice writing. I think most bloggers find that, however motivated they once were, they run out of time and ideas and posting gets harder and harder.

The Intergen blog is a great place for Intergenites to post ideas and thoughts. If you like technology, you should subscribe. At the very least, you should take the 5 minutes or so to read Ashley's post. Who knows, you could maybe even leave a comment.

Saturday, 17 November 2007

Microsoft Dynamics NAV "6.0" Video - You have got to see this!

I have just finished watching the video that I downloaded from the link on the NAV 6.0 Technical Preview page, if you don't have access to PartnerSource, you can download it from mibuso. Microsoft, I salute you! The video is stunning - never mind the whitepaper (which is just "interesting") this is amazing stuff.

Some highlights for me are:
  • The interactive date picker that animates zooming in and out between month and day views.
  • The Freeze columns feature for sales lines (Very Cool - geddit? Freeze Columns, Cool? - Never mind!)
  • Additional fields feature - yes I know we've seen this before but I had forgotten how neat it is.
  • The web service demo. Wow! This is so incredible. Microsoft have really got their act together on this. It seems to be everything we could want.
  • The SharePoint integration. Wow again! This is just astounding. I am running out of superlatives. Employee Portal is a good idea but a bit of a pig to implement. This is just amazing in its simplicity, beauty and elegance.
Just when you think it can't get any better, the piece de resistance is the jaw-dropping, pant-wettingly-stunning demo of using WPF to manipulate supply and demand. OK so this is future stuff but - what a future!

Thursday, 15 November 2007

Developing Solutions for Microsoft Dynamics NAV "6.0"

Interestingly it seems Microsoft are starting to get more info on the next release of NAV out into the channel. If you have access to partnersource, you can download a new whitepaper called Developing Solutions for Microsoft Dynamics NAV "6.0". If you don't have partnersource access, you should keep an eye out for a download on mibuso or dynamicsuser.net.

The document includes a description of the architectural changes in Dynamics NAV "6.0", Development Enhancements, Functionality Redesign Needs, Multiple Client Support, Step-by-step Walkthroughs for creating and modifying pages and reports.

The whitepaper is also available on a new technical preview page that includes a video of the new NAV 6.0 features.

Wednesday, 14 November 2007

Intergen Silverlight Twilight

I have just returned home from Chris Auld's Twilight session on Microsoft Silverlight and was so impressed by some of the demo applications, I felt the need to blog. Chris is a very entertaining presenter and is always a pleasure to watch; and whilst his moustache was definitely lacking in substance, his presentation included enough eye-candy to keep this addict satisfied.

Sadly the demo demons stopped Chris from being able to show the best of the bunch: an xbap application developed for the British Library in order to show some of their rare books. If you have Vista or Windows XP with version 3.0 of the framework, you can view this for yourself here. It's quite scary that I had never heard of xbap before tonight. Chris also showed the New York Times reader which has often been touted as the first WPF killer-app and the usual array of Silverlight based video tools.

Silverlight is cool, there is no doubt about it and the future of computing is set to be great fun. Sometimes I wish I could go back and study again - the resources that are available for our children and the technology at their disposal is quite incredible. The lucky buggers they don't know they're born. Now when I was a lad we had it tough. We used to 'ave to get up out of shoebox at twelve o'clock at night and lick road clean wit' tongue. We had two bits of cold gravel, worked twenty-four hours a day at mill for sixpence every four years, and when we got home our Dad would slice us in two wit' bread knife.

If you want to read the rest of that sketch you can find the transcript of the Four Yorkshiremen here.

Monday, 12 November 2007

vbNewLine in Reporting Services Expression

Just a reminder for me because I keep forgetting. If you want to have new lines in a text box control in reporting services, you can add several fields together and use the vbNewLine reserved word.

For example:

=Fields!Address.Value+ vbNewLine
+ Fields!Address_2.Value+ vbNewLine
+ Fields!City.Value+ vbNewLine
+ Fields!Country_Name.Value

Saturday, 27 October 2007

NoteBurner - Well-written Software that Just Works!

I realise it's unusual to actually purchase music, but I love my i-Pod and the fact that if I hear a song I like on TV I can usually purchase it within a few minutes (after a quick search on www.imdb.com). I wanted something to convert my i-Tunes purchased tracks to MP3 so I could listen to them on my mobile phone and other audio players. I came across NoteBurner and was impressed by the trial software (that works like the full version but limits the track duration to 3 minutes) so I bought it (I think it only cost 50 bucks or so.)

Now I have a Vista machine and I am used to most things not working and I did not expect NoteBurner to fair any better. Well here is the shocker. It installed and it works perfectly. Well done guys! What a great piece of software.

If you want to check this out for yourself, you can go to http://www.noteburner.com/glc/

Sunday, 14 October 2007

Fixed-width Text File Editor - Excel.

Recently I needed to work with NAV to produce some fixed width text files. I wanted a tool to help me check the output file against my file specification. What I really needed was something that let me see the contents of the file nicely split up by column with the columns numbered along the top of the file.

I did a quick search on Google and found little. Then I thought, what about Excel? Maybe I could use Excel to somehow show the file in the format I wanted. Well It was remarkably easy.

I created two worksheets. My first sheet simply contained one cell which contained the full text of the record in my file. Each row contained one record.


In my second sheet, I created a series of column headings and then used the MID function to take a single character from my first sheet based upon the column I was in. The formula looked like this:

MID('Text File'!$A1,Columns!B$1,1)

I then copied this function to all of my cells. I also put in some row headings and some conditional formatting to change the colour of the background if the length of the field was 0 (i.e. no character.)

After generating my text file, I would open it in notepad, select all (Ctrl+A) and copy it, then paste into the Text File worksheet of excel and check the data in the columns against my specification.

It did the job quite nicely.

Friday, 12 October 2007

All Blacks Out - Dynamics NAV 5.1 Cancelled - Whatever Next?

Just in case you haven't already heard, Dynamics NAV 5.1 has been canned. Instead, it will be called Dynamics NAV 6.0 and will be delayed until Q4 2008.

Why? My guess is they just couldn't finish it in time and so, rather than delay it again, they killed it. Now before I start ranting, I have to admit this decision has positive aspects. Releasing an unstable 5.1 product would have shown a lack of vision surpassed only by Wayne Barnes' recent performance in the All Blacks-France World Cup Quarter Final.

The Dynamics NAV 6.0 product (previously known as 5.1, previously known as 5.0) promises to be something special and it is important that it works.

Tuesday, 2 October 2007

A useful SQL Tip - Coalesce.

I do a bit of Reporting Services work from NAV databases and recently a client wanted a list of Names to be presented as a comma delimited list.

Now I knew I had done this before and there was a really smart way of doing it but it took me a while to find it again. The trick is to use the coalesce function. You need to declare a variable to select into and then select from that so this is for use in a table-function or stored procedure.

Try this out in a NAV database when you have more than once company.

DECLARE @CompanyList VARCHAR(1000)

SELECT @CompanyList = COALESCE(@CompanyList + ', ', '') + Name
FROM Company

SELECT @CompanyList

The NAV Team has its own Blog!

Wow! Great news. Finally the NAV team has its own blog. I am looking forward to some great content - particularly with all the changes coming in NAV. I have read some of the blogs that the team have linked to and hope to see some equally in-depth coverage on this new site. I particularly liked the posts on the Dynamics NAV Sustained Engineering blog. This is what we want!

The URL is http://blogs.msdn.com/nav. Enjoy!

Monday, 17 September 2007

You start coding - I'll ask what they want.

I have found myself in a rather unique position. I am working as a developer on a project in which I was the analyst that wrote the programming specifications. As a result I am finding that I approach problems differently when wearing different hats. As an analyst, I think I write decent specs, mainly due to my programming experience. It is really interesting to find myself on the other side of the fence having to chomp my way through garnish and trimmings, in order to find "the meat" of the problem. This experience has challenged the way I approach solution design and programming work and will hopefully allow me to improve in both areas.

When I wear my analyst's hat, I expect certain things from a developer. I expect that they will read the spec first. It seems obvious but you would be surprised at how often I get called to explain details around a solution design when the developer has not actually read the spec. With my analysts hat on I would suggest the following steps to programming against a spec:

  1. Read the spec.
  2. Read the spec again.
  3. Ask questions of the analyst/domain expert to clear up any areas where you are not entirely sure what is meant.
  4. Plan how you are going to implement the solution and break the spec down into a series of "programming tasks".
  5. Code the programming tasks. Make sure you test your work as you go.
  6. Read the spec again. This time you can "tick off" all of the tasks that needed to be completed. Maybe you missed something the first time around.

I also expect that if I have written a spec for something that will simply not work, or could have been done better, the developer will call me and discuss the solution. I do not think I know better than other people, I just know that without a solution design, nothing will happen.

Now I hope I can follow my own advice. So far - I am finding it hard work. The temptation to start coding at the first bit of the spec I understand is almost overwhelming. Developers just love to get coding!

Monday, 3 September 2007

Programming Microsoft Dynamics NAV



A new book by David Studebaker covering Programming Microsoft Dynamics NAV is on the horizon and, if you are quick, you can still get a pre-order discount from the PACKT publishing site.


Unlike the guys on Dynamics User that have commented on Mark Brummel's blog posting, I have not met the author, so I cannot vouch for his experience; but, I am looking forward to getting my hands on a copy. If David Singleton, Erik P. Ernst and Mark Brummel are saying this guy knows his stuff then it must be good.


I have been working with ERP for a number of years and have always been disappointed in the lack of books available for the products I have used. Go to www.amazon.com and search for Dynamics NAV or Navision and you will see what I mean.


Hopefully this is a sign of things to come. I am keeping my eye out for "Configuring Dynamics NAV for Dummies" ;-).

Thursday, 30 August 2007

Any Dataport in a Storm

I'm doing some programming and it's fun! I haven't done any serious programming for a few years and it's good to get back into it, but today I came across some top tips for programming dataports and I don't think I would ever have guessed. What a perfect subject for a blog posting.

Dataports are Dynamics NAV's object for importing and exporting data. The dataport looks a bit like a report when the user launches it with some options to specify field filters and an Options tab for selecting Import/Export and for picking the file name to be used.

For my dataport, I wanted to provide the user with a couple of fields to pick the Gen. Journal Template Name and Gen. Journal Batch Name that the journal lines are to be inserted into. When I added a field to the Request Form, the standard Import/Export radio buttons and the File name field dissappear.

In this post, I'll tell you about a couple of tricks that will help you to put these fields back on the request form and also how to put lookups on the journal fields. I wanted my dataport to look like this:


As you can see, I have the usual File Name and Direction radio buttons and have my two new fields with lookup buttons for the user to select the correct value.

So let's start with the File Name field. Create a global variable of Text 1024 and use this as the Source Expression property for a new text box on the request form. Now here's the trick. If you want the file requester dialogue box to appear without any programming needed, simply make sure the control has an ID of 1. That's it! Thanks to a work colleague for that, I never would have guessed and I thought I was facing a lot of coding around the common dialogue requester.

Next challenge for me was the direction radio buttons. Not being an experienced NAV programmer, I thought that these would use a Boolean control as a Source expression. I tried this and I could not get the buttons to click, no matter what code I added. One of the postings on Dynamics User pointed me to using an Option type field. I created a new global variable as an option string with choices of Import and Export. I then assigned the variable to both of the radio buttons but specified the Import option as the Option property for the top one and Export option as the the Option property for the bottom one. How easy was that?

Now on to the look-up buttons and pick lists. The Journal Template was easy, I just set the TableRelation property on the field to be "Gen. Journal Template". The next bit was a little harder. I wanted the journal batch look-up to only show batches that belong to the journal template I had already selected.

To start, I looked at the G/L Journal form as I knew that this had a batch name field that provided a lookup that worked in the way I wanted. I saw that the field was using a LookupName function in codeunit 230. I put in some code in the OnLookup trigger for the field (after setting the Lookup property to Yes of course) as follows:

GenJournalLine.SETFILTER("Journal Template Name", GenJournalLine."Journal Template Name");
GenJnlManagement.LookupName(GenJnlBatch,GenJournalLine);

On this line, GenJnlManagement is my variable of type codeunit (230), GenJnlBatch is my variable of code 10 which is storing my batch name and GenJournalLine is a record type variable of type Gen. Journal Line (that is required by the function.) The filter, I figured would provide the magic of only showing the batch names for the correct template.

When I called this function, I got an error saying that I needed to set a filter on the Batch Name field. This seemed a bit weird to me since I was trying to lookup the field, so why would I be filtering on it?

I then figured that maybe NAV wanted to know where to put the cursor when it displays the lookup form so I added this line before the call to the codeunit function.

GenJournalLine.SETFILTER("Journal Batch Name", '-');

This line tells NAV to find the first Batch Name that matches the filters I have set on my record handle.

All was sweet! A few little error checks and validations and I was in business. Hopefully, if someone has the same issues and searches for "How to use Radio Buttons in a Request Form" or "Filter must be set before calling LookUpName name function" they will find this post and get a nice shortcut.

Thursday, 9 August 2007

Dynamics NAV 5.1 – Reporting and Web Services

The presentation from Convergence 2007 gave me my first real look at Dynamics NAV 5.1. Following on from my previous post on the Role-tailored User Experience, here are some details on the use of Reporting Services and exposing NAV logic as Web Services.

Reports

Reports in Dynamics NAV 5.1 utilise Microsoft SQL Server Reporting Services. This, we are told, allows:

  • Richer visual effects
  • Interactive reports
  • Export to Excel, PDF on all reports

The transformation tool will (hopefully) create the report for you but you may need to translate some of the code by hand. You will then have the option of adding in your own SSRS specific elements such as interactive elements, dynamic sorting and graphs.

The Development environment in the demonstration still resides in the Dynamics NAV "classic" client but hopefully this will be sorted out before the release (they certainly have plenty of time.)

I am guessing the report dialogue box is going to get a face-lift as the version I saw did not look that great. First of all you get a filtering dialogue box which looks like the Filter pane on the List Place and when you accept the filter, you get a sorting dialogue. I am guessing that if a request form was used, this would have popped up somewhere as well.

Jesper opens the report for editing in the normal way and then, from the Tools menu, selects an option to Transform the Layout (there is another option to Transform the Request Form.) Selecting this option opens a Microsoft Visual Studio window with a Report.rdlc in design mode. I have been using Reporting Services for a good number of years but I wasn't familiar with this rdlc file extension. It turns out that Microsoft added the capability to host reporting services reports in .NET applications using client report definition supported in .NET 2.0. I don't know much about this but you can find out more on msdn.

This little part of the demo has answered the question for me as to how the team are intending to use Reporting Services within the Dynamics NAV application and I think they are being very clever. By using this approach they are giving the users some of the power of reporting services but still keeping control of the reports within the application. This does mean that you will still need a NAV license to view the reports but I am guessing they will make a MOSS-based report viewer.

In addition to the .rdlc file there is a .xsd file (not sure of the purpose of this but it could be a definition of the dataset.) The report has Website Data Source with a Dataset and ResultSet. The information in the report is based on the dataset that is already defined in the report (no hacking SQL here.) It looks like the dataset contains all of the fields from all of the tables within scope plus the values of variables in a single dataset.

Jesper closes Visual studio and returns to NAV and the designer detects that the rdlc file has been changed and asks if you want to load it against the report definition. The whole process certainly seemed quite painless. I would be interested to see if you can use custom assemblies in reports (such as a barcode renderer or other custom graphics renderer.) From the article on msdn it appears that this is supported in rdlc but I am not sure if the NAV application will allow it.

I have to say I found the reports section very impressive and from what I have read, it will be possible to schedule the reports and distribute them using the NAV application so the lack of Report Server hosting is not such a drawback.

Web Services

This section was presented by Kris Rafnsson.

This is where the NAV team have really stuck to that core value of simplicity. Take the page or codeunit you wish to expose as a web service and add them to a new Web Service table in NAV. Give the service a name and tick the Published check box. You now have a web service. How cool is that? Thankfully the demonstration then goes on to show a couple of uses of the new web service.

The first example shows how you can build a simple application in InfoPath that allows you to query NAV customers in less than 5 minutes – without writing a single line of code!

The URL for the web service in the demo is port 3000 on the machine running the service tier followed by WebServices, the company name, Page (presumably code unit would say Codeunit here) then the name that you gave the service followed by a navws extension.

The methods that are available after adding the page as a web service are:

  • Delete
  • ModifyAll
  • Modify
  • InsertAll
  • Insert
  • IsModified
  • Find
  • Get

I am not sure what happens to any custom functions that may also be on the page.

The filter that is exposed allows filtering on any field – just as you would in the full user experience. All of the fields from the table are returned as data. Once Kris ran the form, he was able to pull back data for all customers matching a given filter. It was a nearly trivial example but impressive nonetheless. I would have loved to have seen him use the view and update option to post changes back to NAV – I can only assume that this still needs some work.

SharePoint Server 2007 (MOSS) allows the web services to be consumed from NAV in a similar way without writing any code. In the second example Kris creates a Business Data Catalogue Application (he used a pre-prepared XML file for the demo but said that there will be some tools to help build these xml files hopefully ready prior to the release) to use with the NAV web service.

After importing the application definition, there is an entity available called Customer_Service – I am guessing this can be named in the xml file. He then creates a site and page as normal in SharePoint but selects the option for a Business Data List (a part that displays a list of items from a data source in the Business Data Catalogue.) He then links up the Business Data List to the newly created Business Data Catalogue Application.

When the new page is run, there is an actions drop down button and a nice interface for specifying any number of field filters. He hits the Retrieve Data button and the list of data comes back. He clicked on the No. field for the customer and a new Details form is displayed showing all fields that customer.

What he showed is a SharePoint hosted NAV form with no coding and none of the configuration that is needed for the Employee Portal application. From the looks of things the security and different options that you would have in the Employee Portal are taken care of at the SharePoint end when defining the Business Data Catalogue Application. I was very impressed by this and it looked a lot more polished than the current Employee Portal offering.

Some ideas for how the web services could be used are given by Jesper as:

  • Master Data Management
  • Maintaining Exchange Rates
  • Integration with other Applications
  • Specialised Clients
  • Mobile scenarios

This really is exciting stuff. Come on Microsoft – let's have more of this! Let's have an opportunity to learn about this great technology you are building and maybe make some suggestions along the way.

Wednesday, 8 August 2007

Dynamics NAV 5.1 - Introduction

This presentation from Convergence 2007 gave me my first real look at Dynamics NAV 5.1. Jesper Lachance Ræbild and Frank Fugl do a great job and if you are interested in the next release of Dynamics NAV, I recommend you take 50 minutes to watch the presentation.

The Dynamics NAV 5.1 release is all about adding cutting-edge technology on top of the rich functionality provided in the 5.0 release. Jesper says that there is no new application functionality in 5.1 compared to 5.0 (although there has been mention of RFID support in other material.) The message to companies wanting this new technology is to upgrade to NAV 5.0 now in preparation for 5.1.

Dynamics NAV 5.1 will provide:

  • A Role-tailored User Experience
  • Web Services
  • A 3-tier Architecture
  • .NET Compliance

The way the Dynamics NAV team have delivered the technology has kept to NAV's core values of simplicity, flexibility and ease of use.

The new architecture will use the same application logic, the same office integration, and the same outlook integration as we currently have in version 5.0 so you will be wise to spend your time learning these new features and understanding the application enhancements.

Jesper tells us that the new architecture is meta-data based, and to go from NAV 5.0 to 5.1 you will need to use a transformation process to create the new pages and reports. Microsoft will deliver transformation tools that will take the application and forms and transform them into the new technology. There may be some manual intervention required, but the tools should take you most of the way.

Role-tailored User Experience

Role centre is the new term for the home page that is configured to meet the requirements of the user. The main screen comprises a Navigation Pane and an Activities Pane (tailored to the role being played by the user.) Jesper makes an analogy to a car that remembers your preferences for seat, steering wheel, and mirror positions in order to meet your driving needs. A number of roles from the Dynamics customer model will be delivered in conjunction with tools to allow new roles to be created.

Selecting options from the Navigation Pane takes the user straight into a list view which Jesper called a "List Place" (rather than the card form used in earlier versions.) Apparently, research has shown that in previous versions people would open the menu option and then immediately launch the list from the card in order to be able to search.

When looking at the Sales Order List Place, we see Actions, Related Information and Reports drop down menus. Linked to the list are fact boxes that update relative to the selected record and can show details such as Customer Statistics, Customer Details and Notes.

The main window has an address bar that can be used to navigate in a similar way to breadcrumbs on a web site. There are browser-style forward and back buttons allowing you to easily go back to your previous location (a feature that I think will prove very popular.) Microsoft has clearly put a lot of thought into the new user experience and their efforts appear to have paid off.

The pages can be personalised by the individual users but can also be configured by a systems administrator and distributed out to the users or groups of users.

The character of NAV has remained and I think existing users will adapt easily to the new features. A good example of this is the way record filtering has been implemented. The principal is the same as the old-style record filters but the use of a nice Filter Pane, a new layout and some extra text and buttons helps to make the filtering process more intuitive. Including a few English words such as "Show Results", "Where" the field name "is" made me realise how alien the old filtering form really was. It is good to see that the team have kept the powerful expressions that are used to denote ranges, relative and logical selections. I would like to see a more graphical filtering pane similar to those found in CRM 3.0 or SQL 2005 Report Builder but maybe this will come with time.

The list can be opened in a new window by selecting an option from the Action menu or by using a key-combination. This gives a similar experience to opening folders in a new window from within Outlook. It appears that the design team have used Outlook as their inspiration for how an application should present information and options to the user. The team have done well and the demonstration certainly showed a system that is likely to be well received.

There are many customisation options that should meet the needs of most users. Some of the new features are quite exciting such as the Freeze Pane–a really useful feature similar to the Freeze Panes option in Excel that allows you to lock columns on the left hand side when scrolling horizontally. It reminded me a little of the old Matrix form control but obviously it is showing fields form a single data set and not a cross-tab.

Double-clicking a record in the list place mirrors the Outlook paradigm well and behaves similarly to the process of opening an e-mail from your inbox in Outlook. The details for the record open in a new window called a Task Page. This is similar to the CRM 3.0 experience and I know that some users may not like this. I like it but it does lead to quite a few windows being opened.

The tabbed-form control has been replaced with new Fast Tabs that allow more than one tab to be open at any time with the ability to promote certain fields to be displayed on the "tab band" (my term not their's) when minimised.

The customisation of the task pages allows the fast tabs to be removed from the display or customised to a field level. Each field can now have different levels of importance Standard, Promoted and Additional. A promoted field will be displayed on the fast tab band so that it is visible without needing to open the tab. The additional fields will be temporarily hidden until the user clicks on a control to reveal the additional information. I really like this and it shows a lot of thought from the design team.

It appears that the old drop-down and look-up buttons have been replaced with a single combo-box-style control which makes a lot more sense. I have not seen any evidence of what happens to assist-edit buttons and drill-down fields. The phrase Jesper used was "taking away the clutter" – something I know a lot of users will applaud.

The action pane is similar to the ribbon in Office 2007 although it does not behave exactly the same. I prefer the Office 2007 ribbon. You can think of the Action Pane as a way of promoting common actions from the Actions menu for quick access (you can also increase the size of actions on the Pane which makes them larger and therefore more easily accessible.) Jesper says they have taken "elements of the Office 2007 user experience and added them into Dynamics NAV."

The export to office using XSLT stylesheets works in the same way as NAV 5.0 so the old stylesheets can still be used.

In my next posting, I'll discuss the presentation of the new reporting environment and the use of Web Services.

Tuesday, 7 August 2007

Dynamics NAV 5.1 is soooo coooool!

OK so I may have done a bit of ranting about Dynamics NAV 5.1 being late and that it is going to suck. And I may have made some reference to the Dynamics Development Team being nasty fat hobitses. I am sorry. I was wrong.

Not only does Dynamics NAV 5.1 appear to not suck at all. It appears that it is going to be pretty mind-blowing. The Development Team have really pulled one out of the hat with this one and if we need to wait a while to get it stable then so be it.

So what changed my mind? I have just watched a demo (which you can download from MIBUSO) and the way they have tackled the architecture is simply superb. The demo of creating an InfoPath form that consumes a Dynamics NAV Page as a webservice is pretty stunning. Stunning in how simple it is!

I am so excited, I think I'm going to watch it again. My precious!

Sunday, 29 July 2007

Dynamics NAV 5.1 in Feb 2008 - But I Wants It!

Every time I read about the ever-slipping release date of Dynamics NAV 5.1, I crawl around on the ground grumbling to myself "but I wants it, I wants it, nice smeagle, nasty fat hobitses."

I realise this is an irrational response but the nasty fat hobitses at Microsoft in charge of the NAV 5.1 release schedule* have driven me to it. Now maybe someone can explain to me why we (and by that I mean the great unwashed, average reseller or contractor) are not allowed to sign up for a beta programme for Dynamics products via the connect site - as we can with other Microsoft products. The only explanation I can think of is that maybe the package sucks so badly that the nasty fat hobitses are scared to release it.

I remember when Axapta came out (initially XAL 3.0 and then Atlanta). I was so excited by the potential of the product I could hardly contain myself. When I got my hands on the first beta releases I was amazed at how much it sucked. I guess that's the thing with any radical new technology shift for ERP products. Evolution makes better products than revolution.

I am just hoping that amongst all the hype on role-centric user interfaces, portals, web-services, .NET, Microsoft remember that users and consultants just want a stable product that allows bean-counters to produce their statutory reports and managers to get the information they need to make good decisions. In order to get there, we need good documentation, configurable and relevant help a community of resellers that know the product inside and out.

So how can Microsoft make the product stable, get good documentation and teach their resellers all about the product? Let 'em have it! Warts and all. Yes it will suck in the early stages, but let's make it a better product together.

* I am not actually suggesting that the good people at Microsoft in charge of the release schedule for Dynamics NAV 5.1 are in fact nasty, fat, or hobits.

Do Cats Burp?

The other day my daughter was pretending to be a cat. She climbed on my knee, leant close to my ear and said "burp." Now I have no idea why her game involved a burping cat, but she seemed to find it very funny. Her game made me wonder: do cats burp?

I have owned two cats for over 13 years and I cannot remember hearing one of them burp. Dogs - now I know dogs burp. So the question has to be - are cats physically incapable of burping, or do they sneak off to do it in private?

OK - so now I go off and Google the question and it seems that there are a lot of cats that do. I guess our cats are just more polite. My favourite quote I found was on the Guardian Unlimited Notes and Queries page:

"Never mind dogs, does anyone else have a burping guinea pig? Mine's at it all the time but especially after munching on organic cucumber. Is he unique?"

Wednesday, 6 June 2007

Dynamics NAV 5.0 - Send to Application Feature - The Continuing Saga

Did you ever start something and wish you hadn't?

I thought it would be fun to blog about Dynamics NAV 5.0. I thought it would be easy to write a short posting following the investigation of new features. Why oh why did I start with the send to application feature? It has turned out to be far more work than I had expected. Oh well...

First of all, I would like to mention that I have already written too many posts on this subject. You can see them all by clicking the Send to Application Label on this blog. I won't say how many there are because, no doubt, I will need to add more when I finally figure things out.

I think I should mention Mark Brummel's Reporting from TechEd 2007 posting in which he says:

One of the issues with the office xml interface is that the changing of the stylesheets is very difficult unless you like reading xml schema's.

Fortunately they have changed that and added a stylesheet manager that allowes you to create them in a wysiwyg way. Great! It will be released shortly but there is no official date.

If you have been reading my posts on this topic, you will know that you probably already have a wysisyg editor for the stylesheets needed to transform xml data to Word documents - that is - Word itself. The more I look at the results of using the wml2xslt transform inference tool and compare this to the example stylesheets supplied with NAV 5.0, the more I think that maybe this is not going to work - it looks as though someone really did code this sample stylesheets by hand. I still can't get elements from within the same node to appear in different parts of the document. If anyone has any ideas, please post a comment.

Now the reason I am writing another post on this topic is the changes I suggested making to codeunit 403 will break the standard stylesheets that come with the CRONUS database. Oops.

I have figured out a way to create the stylesheet without hacking the codeunit that also leaves the existing stylesheets in their current working form.

To start with - don't edit codeunit 403 to add the xmlns attribute. Instead, generate the Customer Raw xml file as described but then open the xml file in notepad and manually add the xmlns="NAV" attribute at the end of the Object opening tag.

Now you can follow the previous instructions for creating the Customer Seed xml file (although I still haven't figured out how to use same elements in different parts of the document.)

Finally, use Notepad to open the Customer Seed xsl file (the transform that is generated by the wml2xslt utility) and find the xmlns attribute for the "NAV" namespace. When I tried this, it was ns0 as follows:

... xmlns:ns0="NAV"

Use search and replace to replace all ocurrences of "ns0:" with "" (ignore the quotes so you are replacing it with blanks.) Save the edited xslt file and you're done.

You should now be able to use this xslt file to transform the NAV xml as required - and all your standard stylesheets will still work. Phew!

Monday, 4 June 2007

Dynamics NAV 5.0 – Send to Application Feature – Part 4

This is the last part of a series of postings on using the new send to application feature in Dynamics NAV 5.0.

In Part 3 I showed you how to use Word to create a seed xml document that can be used to create a transformation template. It was late in the evening when I wrote this and there were a couple of mistakes in the posting. I had implied that you could take the SalespersonName element from the Customer element and move it down to the bottom of the letter. Unfortunately when I worked through my own example this did not work (the XSL does not include the text as expected.) I am sure there is a way to do this but I do not know how. If you are reading this and you know about such things, why not post a comment?

In this post, I will show you how to create the XSLT from the seed document you created in Part 3. The first thing you need to do is download the transform inference tool from the Microsoft downloads site. The download will install the tool: a command-line executable with some documentation. I accepted the default install path so, for me, it was installed in "C:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office 2003 WordprocessingML Transform Inference Tool\".

In Part 3
I wrote about creating a seed document. If you have not done that, you will need to go back and follow those steps before being able to use the transform utility. I am assuming that you have a seed document stored as “customer seed.xml”.

Open a command prompt and change directory to the location of the inference tool. Type the following command:

WML2XSLT "c:\customer seed.xml"

Since we have two namespaces in our seed document, you will see a dialogue box asking you to select the namespace you wish to use for the transform.


Tick the option for the namespace you put your NAV document in and hit OK.

Now take a look at the location where you stored your seed document. You will see a document with the same name but a with a ".xsl" extension.

The quickest way to test your XSL is to take your raw xml file and edit some of the data (try changing the customer name). Then save the raw xml file and open it in Word. When you open an xml file in Word, it prompts you for a style sheet to apply. Select the style sheet you created from your seed. You should now see a Word document that looks like your seed but with the changed data values from the raw file.

If everything is working properly, you can now import this style sheet for use with the send to application feature. For details on how to do this, go back to Part 1. Note that our transformation uses elements that are only available for the Customer card export, so when you import this style sheet, do it as a style sheet for form 21 only. You should also ensure that the application for the style sheet is Word.

That’s it. I don’t know if this is the best way of creating your XSLTs but it certainly works for me. The nice thing is that I don’t need to know the XSLT language in order to create the transform (which I think will be true for the majority of people that will need to create new templates.) I must stress that this series of postings is made with no warranty or support. If you follow this, you’re on your own. If anyone finds a better way of creating XSLT transforms for use with Dynamics NAV then I would like to know – please post a comment.

Sunday, 3 June 2007

Dynamics NAV 5.0 – Send to Application Feature – Part 3

This is my third posting on the new send to application feature in Dynamics NAV 5.0. After my initial introduction, my second post explained how to create an XSLT that would show the raw xml produced by NAV.

In this post I am going to show you how you can use a graphical editing tool (that you probably already have) to create your own XSLT. You will need the XSLT we created in Part 2 so if you haven’t read that yet, I suggest you jump back and start there.

I have read a few posts on this topic asking whether there are any tools that can help you create XSLT transformations without having to hack xml in a text editor. You may be surprised to learn that Microsoft Word (2003 or 2007) can be used to format your raw xml file to create a seed file and a transform inference tool (provided by Microsoft) will then create the XSLT for you.

There is one little snag (isn’t there always?) The transform inference tool (what a great acronym that makes ;-) needs the raw xml file to have a namespace attribute. Unfortunately NAV does not include a namespace attribute in the xml document it creates so the first thing we need to do is change the code that generates the xml so that this attribute is added.

Open up Codeunit 403 - Application Launch Management and press Ctrl-End to get to the bottom of the code. The third-to-last function is called AddElement and is used to add all of the elements to our raw xml file. In this example, I am going to use a namespace of ‘NAV’ – but you could use anything, provided it is not used by other XML documents (this is why you often see a URL in the name space.) Add a new line in the code so it looks like this:

ChildNode := ParentNode.ownerDocument.createNode('element', NodeName, '');
ChildNode.text := NodeText;AddAttribute(ChildNode,'xmlns','NAV'); // My new line to set the namespace attribute.


ParentNode.appendChild(ChildNode);
CreatedChildNode := ChildNode;


Now we get to the point where you’ll need the XSLT we created in Part 2. Hopefully you have this hooked up to export to Internet Explorer. I am going to create a new letter template to be generated from the customer card so, first of all, you need to export a customer record to give us our raw file. Launch the customer card (Sales & Marketing > Sales > Customers) and click the Send Options button on the toolbar. Select the Internet Explorer application and the Style Sheet we created in Part 2. Hit the Send button and you should see Internet Explorer launch with an XML document.

In the image, I have collapsed the Control element to show the Customer, WorkDate, Salutation, LetterBody, ComplimentaryClose, CompanyInfo, and DecimalSeparator elements. You’ll notice that the Control element has a different namespace to the other elements (it shows xmlns=“”.) This is because the Control elements are already in the DataXML document when our codeunit 403 runs so it does not get the xmlns attribute added by our line of code. Since we are only going to use the extra elements and not the control elements, let’s not worry about this.

I would expect there will be some changes to the way NAV creates this XML document in the future. As you will see, Word does not work very well with empty elements where the data is actually stored within the attributes. I would not be surprised if the Control elements are changed so that value attribute is actually the text of the control node rather than being an attribute. I would also expect that a namespace attribute will be added – but who knows? Maybe Microsoft has some other grand plan for making it easy for users to create their own XSLT transformations.

From within Internet Explorer, save the XML file as “customer raw.xml” and open the file in Word. I am using Word 2007 but I am pretty sure the same features are available in Word 2003.The first thing you will notice is a whole bunch of empty tags. The first time I saw this, I figured I was doing something wrong – until I realised that the values of the form controls are attributes and Word does not display the attributes in the Word document.


We can get rid of these Control elements. Double click the first Control tag and press Delete. You should now see the Object element with the Customer and other elements beneath it.



Now you can format this document how you want. Create tables, add graphics, etc. When you move data, be sure to copy all of the tags. For example, if you want to put the customer’s name, you would need to ensure it is still within the parent tags of Customer and Object.


Above you can see my re-formatted document. I find it easier to work with the format with the XML tags displayed. Then I remove the tags by removing the tick from the Show XML tags in the document. It looks like this:



Save your document in an xml format when you’re happy with the layout. In Word 2007, this means saving as a Word 2003 xml Document. Make sure you remove the tick from save data only. If you don’t remove this tick, your transformation won’t work. I find it easier to save my document with a name “customer seed.xml” as this lets me easily identify which file contains the raw data and which is the seed for my transformation.

That’s all for now. In my next post, I’ll show you how to take your seed document and generate the XSLT you’ll need for NAV to generate these documents for you.

Saturday, 26 May 2007

Dynamics NAV 5.1 – Incredible New Features

There is a new version of Dynamics NAV and it has got me pretty excited. Not because of its new features, or technology, or roles-based user interface, but because I have never used it.

There is a magical time in a product’s life when it is perfect, and, for me, Dynamics NAV 5.1 is there. Having never used the product, I can unreliably inform you it is the best version of Dynamics NAV yet. The roles-based client is intuitive and a pleasure to use; the online help has been completely re-written with a focus on the roles within an organisation and the business processes that keep it running.


In a stroke of genius, Microsoft has completely re-engineered the application architecture in order to make all functions available to the NAV developer. Any actions that can be triggered by a user can now be triggered through code. This is probably the one non-feature I find most exciting. NAV developers can now create tools that will dramatically improve the Dynamics experience for re-sellers and end-users alike. The testing tool is a prime example of this. Similar to the Record Macro feature in Microsoft Office, it is now possible to record a series of actions, save them as a script (using your preferred language of C/AL, C# or VB.NET) and finally edit the code to produce testing programs. This will allow new features to be automatically tested to ensure they meet requirements and do not introduce nasty side-effects to other parts of the application. The application comes with a set of pre-defined localised test cases that allow Dynamics NAV resellers to develop their own applications and have total confidence that they have not broken the standard application.


Programming objects within Dynamics NAV can now be exported and imported through code (either using the built-in programming tools or via the web-service interface.) This, coupled with the fact that all programming objects are now stored internally in an open XML format, means that Dynamics NAV is now limited only by the imagination of the business community and the skills of the developers. Being able to hook into events makes it possible to write tools that will revolutionise version control within business applications. One of the sample applications illustrates this feature by waiting for customers to make modifications to their programming objects, and then sending a copy of the change to the Dynamics NAV Partner. No longer will we need to worry about lost, undocumented, or inappropriate programming changes.

These new features are available for a limited time only. Eventually, Microsoft will release Dynamics NAV 5.1 and my fantasy vapourware version will be replaced with the real thing, but until that day, I have the perfect ERP system.

Sunday, 20 May 2007

Debuggered

I don't know how it happened but I broke my debugger, but it's OK; I fixed it! After reading some posts on MIBUSO (or was it dynamics user?), it seems I am not the only person this has happened to. Thankfully, reading the forums also pointed me to the solution.

The symptoms of the problem are that the debugger for Dynamics NAV 5.0 (and earlier versions) launches but the code window is not displayed. On my machine this happened for version 5.0, version 4.0 SP3, 4.0 SP2, clean installs, you name it. The only thing I could do was close the debugger window, which caused the window to close and then be re-launched after a short pause (I figured this was because the program was getting to the next trigger. You can see similar behaviour if you close the debugger when it is working properly). I kept closing the window and eventually returned to NAV (giving me chance to turn the debugger off).

I logged this as a support issue with Microsoft but the suggestions they gave me (based upon previously solved incidents) didn't help. The premise of their suggestions was that the debugger and application communicate using TCP/IP and that something (most likely an anti-virus program or firewall client) was intercepting this communication and preventing the debugger from displaying the code.

After trying various options suggested by Microsoft, I finally got fed up and searched for the solution myself. I was quite surprised to find lots of people with the same problem - although there were a large number of postings from people that had either not found a solution or not updated their post. I think the best posting I found was on the dynamics user group (although I think the same solution was shown on MIBUSO).

For me the solution was to use Add/Remove programs from the control panel to remove a program called "Advanced Gateway Client". I don't remember installing this program and after I removed it the only difference I noticed was that my debugger worked again. Debuggered!

Sunday, 13 May 2007

Dynamics NAV 5.0 – Send to Application Feature – Part 2

In my previous post on this topic, I looked at the send to application feature in Dynamics NAV 5.0. I explained that you can send data from NAV to Word, Excel or any other application by using an XSLT template to transform the XML data into a format that the target application understands. I also introduced the WordprocessingML language that can be used to create Word documents as XML files – a feature that Microsoft introduced in office 2003.

In this post I am going to show you how to see what NAV is producing as the starting XML file before any transformation is applied. Then we'll look at the WordprocessingML schema and create a simple Word document using Notepad. If you want to see the results of your efforts, you'll need Word 2003 or 2007 installed.

The first thing I wanted to know when I saw this new feature was how it worked. I understood the concepts of XSLT and WordprocessingML and applying transformations to XML files but I had never done it in practice. I didn't know what NAV was giving us to work with. In order to be able to make my own transformations, I needed to first know what my starting point was.

XSLT is a language that can be used to transform an XML file from one format to another. I knew that I could load my own XSLT file as a template for NAV to use but I didn't know what my starting XML file would be. I would like to pretend I am some kind of XSLT guru, but the truth is I just asked some people at work. My question was "what do I need in an XSLT to make my output file a copy of my input file?" The hardest part was convincing people I was not crazy and listening patiently as they explained that there was no point in applying a transformation that would make the output file identical to the input file. I think the answer ultimately came from a Google search – but it helps to know what you are looking for.

Open up Notepad and enter this text:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:copy-of select="/" />
</xsl:template>
</xsl:stylesheet>

Now save the file as "Copy All.xslt".

Since the file is so short, I will give you my expert explanation of its contents. The first line is probably really interesting. All I know is you need it - so put it in there for all of your XSLT files otherwise they won't work. It's something to do with defining this document as being a stylesheet and indicating that anything that starts with xsl: in the document will be defined in the schema that is referenced by the namespace provided. Incidentally, if you paste the http://www.w3.org/1999/XSL/Transform URL into a web browser, you'll see a link to the XSL Transformations specification. If you really want to learn about XSLT this is probably a good starting point.

The second line says find the start of the file you are reading.

The third line says copy everything without changing it.

Lines four and five are the closing tags for lines two and one respectively.

Now we have our transform, let's look at applying it to NAV. First we'll set up a new application to handle our transform. We need something that's good at displaying XML files – so I decided to use Internet Explorer.

Select Administration > IT Administration > General Setup > Launch Applications. The Send-to Programs form is displayed showing two programs: Excel.exe and Winword.exe.

Create a new record and enter IEXPLORE.EXE as the executable and Internet Explorer as the name. Press Esc to close the window.

Now I want to import my new template and tell NAV to use Internet Explorer to launch the resulting XML file.

Select Administration > IT Administration > General Setup > Manage Stylesheets. The Manage Style Sheets form is displayed showing all style sheets that have been set up for the database (oops – maybe that should have been set up as data per company since your templates are likely to contain company logos – as Microsoft would say: "this is a reseller opportunity" meaning: "oops we stuffed it up – you fix it"). In the standard CRONUS company this will mean a default stylesheet for Word and Excel (common to all forms) and a few form-specific templates (Customer Card letter template, Vendor Card letter, etc.)

Before you can create a new template, you need to select either the Style sheets common to all forms or Style sheets for this form only radio button against the Show label. For this example we want to be able to export from any form so click the Style sheets common to all forms radio button.

Maybe you are thinking you can now create a new record in the list of stylesheets – but that would be too easy. Instead, you should select the Import option from the Functions menu button. The system will display the Import Style Sheet form. Use the assist edit button to open the "Copy All.xslt" you saved earlier or type the path and file name into the Style Sheet field. Enter "Copy All to IE" into the Name field. Use the look-up button to select Internet Explorer as the Send-to Program. Click the OK button to import the stylesheet. You should now see a new line in the Manage Style Sheets form and, if all has gone well, we will now be able to test it out.

Open the Customer Card and click the Send Options button. The Program Selection form is displayed. Select our new Internet Explorer program. The Style Sheet field is showing the first style sheet that can be used for the data we are exporting. If it is not the one you want, click on the field and use the look-up button to select a different style sheet – in this example you should have only one stylesheet set up for the Internet Explorer program. Click the Send button.

If all has gone well, you should now see Internet Explorer with a new xml file displaying the information from the Customer card. Take a look at our xml file. You'll notice that the first part just gives us a hierarchy of all the controls on the form starting with Form, then Tab Control, then Tab Page, then a mixture of labels and text boxes. After the controls, we see some other sections for Customer, WorkDate, Salutation, CompanyInfo, etc. This suggests to me that there is something funny going on. How does NAV know that these things are important? We'll look at how you can create your own custom content to the XML file in a later posting.

To wrap things up, let's take a look at a simple WordprocessingML file. In my next post on this topic, I'll look at how we can create an XSLT to make a Word document in a format of our design.

WordprocessingML is a neat language that allows you to serialise an entire Word document as an XML file. The majority of the file contains tags that start with "w:". The text is typically built up from paragraphs (w:p), runs (w:r) and text (w:t) elements.

Open up Notepad and enter this text:

<?xml version="1.0"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
<w:body>
<w:p>
<w:r>
<w:t>WordML Rocks!</w:t>
</w:r>
</w:p>
</w:body>
</w:wordDocument>

Now save the file as "WordML Rocks.xml". Even though the file extension is xml, the file is displayed with a WordML icon. This is because of the progid="Word.Document" property. Explorer is looking inside the xml file to determine how to display the icon.

Double click the file and Word will launch and display a document with a single line of text.

That's all for now. If you want to earn bonus points, you could take a look at the XSLT templates used in the CRONUS company and the XML files they produce.

Wednesday, 9 May 2007

Help - I Accidentally Updated My Navision Database!

I spotted a great posting on the Navision News Group today.

Dynamics NAV has this nasty habit of stamping the version number of the client program against the database. So the scenario goes something like this:

  1. You have a 4.0 SP1 Client and you (and all your co-workers) are accessing your database quite happily
  2. You install a 4.0 SP2 or SP3 client just to take a look at the exciting new features and fire-up the new client
  3. The client looks at your ZUP file and finds the server and database details you last used and tries to open the database
  4. The client puts up a message asking you if you want to upgrade your database to a new version
  5. You don't read the message and click Yes because that is what all users do - it's easier than thinking
  6. The client puts up a second message saying "I know you didn't read the first message, because no-one ever does, but are you really sure you want to upgrade the database?"
  7. You don't read the message and click Yes again
  8. The client lets out a deep sigh and proceeds to update your database
  9. You get to use the new client on the database and everything is hunky-dory.

Meanwhile...

  1. Your co-worker with their 4.0 SP1 client tries to open the database and they see a message: "This database has been upgraded to a later version by someone who does not read warning messages, you must find that person and taunt them."

I may have changed the wording on some of these messages slightly - but you get the gist.

What I didn't know was that, according to the Ian C who posted the response, if you are using a SQL database, all is not lost. There is a dirty hack - which I must say I have not tried out - in which you can edit the databaseversionno field on the $ndo$dbproperty table. I would suggest creating a new database with the correct client just to see what the version number is - in Ian's example he talks about changing the value from 60 to 40.

I actually tried to use this today (15th September 2007) and it sort of worked. I tried to change a 4.0 SP3 back to a 4.0 no service pack. When I changed the value of the databaseversionno field to 30 the database would still only open with a 4.0 SP1. Maybe I did something wrong. What I did do is make a note of the version number used for a number of different versions:

3.10A = 13

3.60 = 14

3.70 = 17

4.0 = 30

4.0 SP1 = 40

4.0 SP3 = 60

5.0 = 80

5.0 (Build 25653 known as Update 3) = 82

5.0 SP1 = 95

Thursday, 3 May 2007

Dynamics NAV 5.0 - Send to Application Feature - Part 1

There are four new buttons on the toolbar for Microsoft Dynamics NAV 5.0. This posting starts to look at the three buttons used for sending data to other programs.

You’ll find the relevant help topic under Welcome to Dynamics NAV Help > Using Microsoft Dynamics NAV > Sending Data to Other Programs. This tells us that we can export data from NAV to other programs such as Microsoft Office Word or Excel. You can also export data to any other program that can handle an XML file.

To see this in action, use the CRONUS demo company for version 5.0 and open a customer card (Sales & Marketing > Order Processing > Customers); I am using customer account 10000 for The Cannon Group PLC. Now click on the Send to Microsoft Office Word button (or use the Ctrl+W shortcut key).

Word springs into life with a new document (called “10000 The Cannon Group PLC – Customer Card.xml”), stored in your temporary file path.

The sample document is a letter formatted to contain a CRONUS company logo and address details, Customer Address Details, Today’s Date, Salutation, etc. There is a place for you to type your letter contents.

Close Word and return to Dynamics NAV. Now hit the Send to Microsoft Office Excel button (you could use the Ctrl+E shortcut).

This time Excel opens and we are looking at another xml file. There is one Excel sheet within the workbook for each of the tab pages on the NAV form. Each sheet contains a title, the caption for the tab and the labels and data values for each of the fields on the tab page.

From Office 2003 onwards, Microsoft provided the ability to save a Word or Excel document as an XML file using their WordprocessingML or SpreadsheetML schemas. The new feature in Dynamics NAV takes advantage of this by grabbing the information on the screen and generating an XML file which it then transforms into another format by using a pre-defined XSLT (a file that describes how one XML file should be transformed into another).

You can create your own XSLT files and load them into NAV so that they can be used to make transformations. You can even specify your own applications to handle the new file, so you are not limited to using only Word or Excel.

I have two issues with this new feature. 1) Creating the XSLT file is not easy. If you have the ability to do this, you could probably have written some C/AL code to create the Word document directly. 2) Why would you use this feature? I am really struggling to think of a situation where this would be useful. If anyone has any suggestions, I would like to know.

I could only think of one possible use for this: if I wanted to write a user training document or document a test case and I wanted to list all of the fields on a form, this would be quite a neat way of doing it, but this is not a typical scenario for an end-user. Maybe I am not thinking laterally enough.

In the next post on this subject, I’ll take a look at how to set up a new XSLT so I can see what NAV is giving us to work with. Then, I’ll look at creating a Word document from scratch by making a new XSLT for WordprocessingML.