I started reviewing Leslie Vail’s book, Developing Microsoft Dynamics GP Business Applications,which was published at the end of December by Packt Publishing, a few weeks ago. To do this review I decided to take a read through and complete all the examples she gives on developing an application as I’ve only had very limited experience with Dexterity;
Today I’m taking a look at Chapter 5 which covers sanScript and how to add it to windows to enable the required functionality. The key topics to be covered are:
- Introduction to sanScript
- Scrolling Windows
After completing this chapter I should have a working version of the window created in the last part of my review.
As with previous chapters of the book, Leslie gives a nice detailed, yet clear, introduction to sanScript; what it is, how it is structured and the naming conventions which apply.
One of the most important elements in sanScript is interactions with tables; creating, retrieving, updating and deleting of records. Leslie explains this well (with suitable diagrams), along with the potential pitfalls of deleting records, and always giving examples of the naming of commands which is of benefit when progressing through the chapter.
In working through the examples I am of two minds. The examples of sanScript you need to use to add to your form are very good; but they’re presented as screenshots which mean you can’t copy and paste the script.
This is bad, in that it means a lot of typing.
This is good, because it means you have to type and think about what you’re typing it as you go. And certainly for me, I learn better by doing than just reading.
One of the main complexities of sanScript covered in this chapter is the handling of ranges of data; such as the list of Contacts attached to the Customer on the form being created; the explanation given by Leslie is detailed and backed up with an easy to understand example.
However, the practical example that then follows seems to have a couple of problems.
It requires some changes to the Customer Contact Maintenance window which was created in Chapter 4 (covered in part three of my review). The new fields created in this step has a lookup field attached which does not exist and the creation of it is not covered.
Also, in the screenshot code samples, there seemed to be one or two lines/explanations missing (the one that springs to mind was the else clause on the Customer Contact Lookup window PRE script). In this chapter I haven’t found it too troublesome to work around these issues as I found it fairly easy to identify when this had happened, but I do have a programming background which might explain why this didn’t bother me too much. For those without that background, it may be more of an issue.
Leslie then covered how to run custom queries against SQL to load ranges which covered the call and how to handle string terminators and other special characters. I always like to see this type of coverage as it shows the flexibility of the language and gives ideas of the scope of what is possible by connecting to SQL Server (an area in which I am comfortable).
I’ve been writing this review in chunks as I have progressed through the chapter and, having read back over the above, I feel that I come across as somewhat negative on the part of Chapter 5 relating to the introduction to sanScript.
Yes, in part I am slightly disappointed in the code samples given which I feel do miss one or two bits of important information, but, at the same time, I think the examples are very good and do allow me, for instance, to reach the point of understanding what is needed to make the Save button or pre-window event happen correctly. So the introduction to sanScript does actually do what it says it will; it gives me an introduction to sanScript which contains an understanding of how it works and what it does.
The second part of the chapter covers the Scrolling Windows, starting with an explanation of what one is and where they’re used. Leslie gives an example of each window type, with screenshots, explaining what each element is and how it is used. She also references the fact the SDK is loaded with information on how to call the different window types from Dexterity; and follows up with an example of configuring a call to a lookup window from the Customer Contact Maintenance window we’ve been creating.
Okay, well adding the script to the lookup button was easy enough, but Leslie then suggests using Test Mode to give the button a try; the problem is Test Mode opens Microsoft Dynamics GP with the development dictionary loaded. At this point we haven’t done any code to add the new window to a menu or window so there is nowhere from which to open it.
Instead I’ll progress onto the Triggers section and see how to use triggers to load the window. I’ll then come back and test the lookup button.
Again the coverage of triggers is both detailed and understandable. With any explanation of programming terminology the subject is at risk of veering too far into the esoteric where only an expert will understand it, but this is a pitfall which Leslie has avoided falling into and gives a good explanation of the types of trigger available in sanScript along with a detailed discussion of how they work in a readily accessible manner.
In fact, the explanation of triggers is hugely detailed and comprehensive covering all of the different types of triggers available for use with full details on how to use them. This is not a section to read quickly due to the detail but one to read and savour if you’re to get the best out of it.
The final step of the chapter is to create a trigger on the Customer Maintenance window to open the newly created Customer Contact Maintenance window; my new form works!
That’s the good part. The bad part is the window doesn’t look right due to the problems I highlighted in the third part of the review. Also, the tab order is wrong, the lookup window doesn’t allow me to select anything (no actions attached to the buttons), the scroll buttons scroll between Customers but leave the contact details for the previous contact untouched and I can’t add any phone numbers to the scrolling window.
However, I can add new contact information and save them away, change them and delete them.
I think I have followed the steps as laid out in the book so the window should work fine; but it is possible that I have mistyped a section which has resulted in some of the problems.
I will say that I don’t think any of the problems are major; it’s sort of what I expect to see when I approach a language for the first time (let’s all not talk about my initial experiments with PHP :shudder:).
Overall, I thought the chapter was through and detailed while remaining accessible. If I sat down and looked at the problems I’ve encountered with both Dexterity and sanScript I feel I’d be able to resolve them without too much trouble and I think I will look at doing that in the future.
However, work and other commitments prevent me from doing that at the moment. Instead I’ll move along to the next part of the review where I’ll take a look at Chapter 6 and deploying a Dexterity solution; something I have actually done many times. I used to work for a company where someone else did the Dexterity development and I did the build and testing so this will feel a bit like a blast from the past.
You can purchase Leslie’s book either direct from Packt Publishing or via Amazon:
|Amazon UK||Amazon US|