With each new version of SQL server some old SQL habits have to die.
In Dynamics GP we often find document numbering sequences that are padded with zeros to facilitate sorting/ordering and to “look normal” on printed documentation.
For example website orders may be imported via econnect into GP in the range:
W00000001 to W99999999
Now sometimes we need to generate sequences of those numbers or join with tables holding just the number and no prefix. There are very many examples of this, originating from various reasons all now in my TSQL code, embedded in stored procedures.
DECLARE @WebOrderID int
SELECT 'W' + REPLACE(STR(@WebOrderID, 7), SPACE(1), '0')
The above shows a contrived example, to give us the result: W0000022 by overlaying on a template.er
The above was the way we did things in the 90s, new kids these days (starting with SQL 2012), can use the much simpler to read and use FORMAT command . A command that supports standard .NET format strings.
DECLARE @WebOrderID int
This produces much more easily read SQL and assuming you don’t need to be backward compatible, it seems the best way to go forward.
Old habits die hard, I need to start thinking FORMAT for these kinds of problem where pre-SQL 2012 support is not required.
User reported that Microsoft GP crashed with “Microsoft Dynamics GP has stopped working”. This occurred when attempting to export the Financial Elementz window Receivables Transaction Analysis to Excel.
By closing all instances of Excel on the machine and then examining the user’s Windows Task Manager, it was revealed that there was a hidden (Crashed?) copy of Excel sitting in process. The orphan process was “end tasked” using Task Manager.
After removing all instances of Excel the export to Excel started working again. It turned out to be a quick and easy fix.
Drop me a comment if this turned out helpful!
You might have this problem where Dynamics GP claims “you do not have access to open this window”. The extender manual tells the basics of setting up security for extender to allow access to windows, it does not mention that the inquiry windows have their own security section or my stupidity.
I will not entirely repeat how to set security in extender, other blogs and the user guide helps on the detail, but in summary:
Set up a Security Task, name it something useful, then be aware if this is an enquiry (inquiry) window you need to find the check box under Extender>>Extender Resources>>Inquiries for the window in question and then check it.
Also note to ensure that you are not working in a test company because while you are debugging an issue, it is all too easy to find yourself in another company, thinking you are changing the permissions for the production company, when you are not.(I am not admitting to anything there…but we’ve all done it all too often right?!)
Below is the inquiry version of the window security.
Here is normal version.
I hope this helps someone out, let me know with a comment if it did!
I’m certain you all know the above and practice it regularly. First a little background…
In Dynamics GP we wrote a very basic “CRM like” system using a .NET GP Addin, that lays over the top of the SOP module. It introduces the concept of contact records, with many-many relationship to customers/debtors in GP. The list of contacts associated with an account can be viewed from a sales order and debtor card. The contacts are syncronised to MailChimp (saas email marketing). Marketing click through and email opens are also synced back to be shown next to the contact record. The contacts are also synchronised with the various ecommerce websites that feed GP, contacts being soft linked to website users.
The website integration means there is a merge required to accommodate new and updated records when users update details on the websites. This is where my oversight came to light. Duplicate records were being created, it turned out to be due to diacritics. Below is an example of a duplicate record.
The example shows what we know they are the same person, but SQL MERGE statement, due to the default collation on the database, sees these as the same. Instead it sees two distinctly different names and thus creates a new contact record for the second instance, where it should (in our case) be merging changes into the first instance. This is an over simplified version of what happened as there are other keys involved and lot of business rules. Obviously SQL is not doing anything wrong but it is not our desired behaviour for this particular task.
It is easy to resolve, when comparing records, for our purpose, we override the default collation and use a Accent Insensitive (AI) version instead, for example:
where “AI” at the end of the collation name is the key to the insensitive comparison.
t2.FirstName = t1.FirstName COLLATE Latin1_general_CI_AI
The implementation depends on your own needs, my point for this post is to not forget about this issue if merging data from different sources where there may be a mixture of diacritic and non-diacritic text entered. Integration of data continues to have its challenges…