Wednesday, July 30, 2014

Cool SQL Server Management Studio editing trick

By Steve Endow

I've been using SQL Server Management studio since long before it was called Management Studio, but I regularly stumble across some new feature or shortcut that I never knew existed.

Today I was querying several tables.



I then wanted to delete the contents of all of those tables.  One trick I use is to hold down the ALT key to select a vertical column of text.  I use this to highlight the "SELECT *" text on all of the lines at once.


I am then able to delete the selected text for all lines.


 So that part I knew.  But now I wanted to put the word DELETE at the beginning of each of the lines.  Normally I would copy and paste it on every line.  But this time, I just started to type the word DELETE.


As I typed, the characters appeared on all of the lines simultaneously!  The thin gray line is the former selection area, and it essentially turns into a giant vertical cursor on all of the lines.


So I just typed the word DELETE once, and it appeared on all lines.  Presto!

Pretty cool.

I just tested this technique in my UltraEdit text editor, and it worked there as well.  It did not work in MS Word though.

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter

http://www.precipioservices.com

How will Dynamics GP Document Attach affect my database size?

By Steve Endow

I've seen a few complaints about how the Dynamics GP Document Attach feature will cause chaos and havoc because documents are stored in the SQL Server database, rather than on the file system.


It seems that some people are envisioning massive database growth that will make Dynamics GP databases difficult to manage.

Is this a valid concern?  Will document attachments cause a significant increase in database size?  I think it depends.

First, let's consider the attachments.  Before you can assess the impact on the database, you'll need to understand what you will be attaching.

Thinking about volume, how many documents will you attach per day, week, or month?  Will you be attaching documents to master records like Customers?  Or transactions like Sales Orders?  Will you attach a document to every Customer record or every Sales Order transaction?  Or only a portion of your records and transactions?

Next, what types of documents will you attach?  Word documents?  PDFs?  Image files?  How large will each file be?

Checking a few random samples of files I have handy, here are some sample file sizes I'm seeing.

12 page Word document:  178 KB
21 page Word document:  515 KB
1 page PDF of scanned grayscale document:  328 KB
3 page PDF of scanned grayscale document:  1,099 KB
1 page PDF of color web page printed from web browser:  30 KB - 300 KB  (varied based on images in file)

Although the document sizes are relatively small, the sizes vary significantly, which is important if you need to store thousands of them.

Let's suppose that the typical document is a 1 page PDF of a scanned grayscale document, so I'll work with my 328 KB test file.  (You may very well have a better scanner or better scanning software that produces smaller files, so you'll have to do some tests to determine your average file size.)


I'll then assume that these documents will be attached to 50% of my Sales Order transactions.  Assuming that I process 100 Sales Orders per day, that will be 50 document attachments at 328 KB each.  There is some additional overhead to storing the attachments in the database, but for now, let's just work with the actual file size on disk.

328,000 bytes x 50 = 16,400,000 = 16.4 megabytes per day

16.4 MB x 250 work days per year = 4.1 gigabytes per year

So in theory, based on the assumptions in my scenario, I will be storing an additional 4.1 gigabytes per year in my database.  Is that a lot?  I think that depends on the business, but in general, I would say that 4.1 GB shouldn't be a huge issue for most customers.  A few considerations might be how that larger database will affect backup routines, or if you compress your backups, will they compress as well with the binary data from the attachments?

But there are certainly customers where it may be a problem.  Consider large customers that have 5 or 10 very active Dynamics GP databases.  If they have similar numbers of documents for all databases, that could mean 20 GB to 40 GB of documents per year.  And if you consider that the customer may retain those documents for several years, you could end up with a significant amount of space consumed for document storage.

So yes, it is possible that Document Attach could result in significant database growth for certain larger or high volume customers.

However, I think this has to be considered in a larger context.  Document Attach is an optional feature in Dynamics GP--you don't have to use it, and I suspect many customers will not.  For customers that like the feature, if you don't need to attach a lot of documents and have simple requirements, it will probably work well.  If you need to attach a lot of documents, or if you need to attach large documents, Document Attach may not be the best option for you.  You certainly have other options, as there are plenty of document scanning and management solutions (including third party add-ons for GP), and those options will probably have several other features (indexing, searching, routing and workflow) that are valuable to you.


Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter




Adding additional voucher fields to the Payables Check Remittance report

By Steve Endow

I just had a request to add an additional voucher field to the payables Check Remittance report.  It has been a little while since I've had to do this type of modification in Report Writer, so it took me a few minutes to remember the process.

In this case, the client wanted the TRDISAMT field added to the remittance.  That field is not available by default in the Check Remittance report field list, so we have to add the voucher table to the report.  Sometimes additional tables can easily be added to the report, while in others, you have to join in a new table yourself.

First, insert the Check Remittance report as a Modified Report and click Open.

On the report Definition window, click on the Tables button.


On the Tables window, you should see 3 default tables for the report.


These three tables do not have any additional table relationships available--if you select one of the report tables and click New, the Related Tables window is empty.


To remedy this, we need to create a new Table Relationship.  Looking at the three available tables on the report, the Temp table is not an option, and the Currency Setup is not a candidate.  Our only hope is to join the voucher table to the Payment Apply To Work table.

Because the PM table names can get confusing, and because Report Writer inconsistently displays the Technical Name vs. the Display Name, I recommend using the Resources Description window in GP to confirm which table we need to work with.


The PM Payment Apply To Work File has a Technical Name of PM_Payment_Apply_WORK.  We'll need to know this name for the next step.

So then head back into Report Writer and click on the Tables button, then select Tables.


In the Tables list, locate PM_Payment_Apply_WORK and click on the Open button.


In the Table Definition window, click on Relationships.  We are basically going to tell Report Writer how to join the voucher table to the Payment Apply Work table.


Notice that there are no Table Relationships--this corresponds to what we saw in the report--there were no additional tables to select.

Click on the New button.


In the Table Relationship Definition window, you will select a Secondary Table.  We want to add the PM20000 table, which is the PM Transaction OPEN File.

You will then choose Key2 as the Secondary Table Key, and link the Apply To Document Type and Apply To Voucher Number fields from the Apply To Work File.  Make sure to use Apply To, and not Apply From.  Then click on OK.


Congratulate yourself--you now have a new Table Relationship!

So now that you've done all of that work, you need to add the table to your modified report.

Open your modified report, click Tables, select the PM Payment Apply To Work File, then click New.


Select PM Transaction OPEN File and click OK.  Then close the Report Tables Relationships window and click on Layout to open your report.


You should now see the PM Transaction OPEN table in the drop down list for your report, and can then add the Discount Amount field, or any additional voucher field, to your remittance report.

While this process did have several steps to add the new Table Relationship, be aware that the Dynamics GP reports vary dramatically in terms of complexity.  Some reports are very complex, with much more involved tables and relationships that make it difficult or impossible to perform the joins required to add another table.  So just be aware that certain report modifications could get very complex.


Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter



Thursday, July 24, 2014

C# is great, but can be very annoying

By Steve Endow

I just had a call to review an error that was occurring with an integration that I had developed.

The integration was adding records to a Dynamics GP ISV solution and while importing a large data file, it reported 6 errors.  The ISV solution simply returned the generic .NET / SQL error indicating that a "string or binary data would be truncated."

The ISV has almost no documentation on their API, and the error message didn't tell us which field was causing the problem, so we reviewed the records that were getting the error, and saw that the customer names were very long.  We assumed that a long company name was the problem.  Looking at the ISV tables, I found that it only allowed 50 characters for the company name, unlike GP, which allows 65 characters.

Fine, so now that we found the likely issue, I had to modify my import to truncate the company name at 50 characters.

I opened my C# code and quickly added Substring(0, 50) to the company name string, and tested that change, wondering if it would work.  C# developers will probably guess what happened.

"Index and length must refer to a location within the string"

Lovely.  Okay, so off to Google to search for "C# truncate string".  That search led me to this StackOverflow discussion of the topic, where I saw, thankfully, that I wasn't the only one with this question.  Although I found a few solutions to the problem, what was very disappointing was that there was even a discussion of the topic and that there were multiple solutions to the problem.

Seriously?  A modern business programming language can't just truncate a string?  We have to measure the length of the string and make sure that we send in a valid length value?  That's like selling someone a Corvette and then telling them they have to adjust the timing of the engine themselves if they want to go over 50 mph.  Why in the world haven't they provided a means of natively truncating a string?

As one post on the StackOverflow thread points out, the Visual Basic Left function provides such functionality without throwing an error, so why does C# insist on making developers across the world all write their own quasi-functions to perform such rudimentary tasks?

How about the C# "Right" string function?  Oh, you mean the one that doesn't exist?  Ya, that one, where you have to create your own quasi-function, or yet again reference VisualBasic to perform a simple, obvious task.

It's just silly.  A purist says something like what was mentioned on the StackOverflow thread:  "That's probably why the member function doesn't exist -- it doesn't follow the semantics of the datatype."  Seriously, that's the explanation or justification of why this modern language is wearing polyester bell bottoms?  The semantics of the datatype?  As in the string data type, where people actually need to truncate strings?

Don't get me wrong, I really like C# and now prefer it very much over VB, but when I come across annoying gaps in functionality like this, it just makes me shake my head.


Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter



Have you registered for reIMAGINE 2014 yet?

By Steve Endow

Is there any spot on the planet more inviting, more bucolic, more exciting, or more of a global destination than Fargo, North Dakota in November?

Nope.

On November 9-12, 2014, the world will be watching as Dynamic Partner Connections hosts the reIMAGINE 2014 conference at the posh Holiday Inn Fargo, the premier resort and spa for Fargo travelers.

There will be dozens of sessions, jam packed with Dynamics GP goodness, Microsoft campus tours, and even a cocktail reception.  Did I mention that the Holiday Inn has an indoor pirate ship water park?  Seriously, no joke.  Where else can you experience an indoor pirate ship?  Imagine the stories you'll be able to tell when you get back from the conference.

My fun story is that at the GP Tech Airlift conference in Fargo two years ago, there were TWO different fake bomb threats.  Yes, in Fargo.  One was at Fargo's world famous Hector International Airport on the day before the conference, which prevented anyone from entering the airport and stopped all departing flights.  Fortunately, they were letting people leave the airport, but the catch was that there were no rental cars, since nobody else could come back to the airport to return their rental cars!  Luckily, I was getting a ride from a clever colleague who bribed the woman at the rental car counter, who then snuck us the keys for the last car on the lot--a top of the line minivan (aka the Fargo party bus).  The second bomb threat was at North Dakota State University on the day after the conference.  Fargo police blocked off a perimeter around the entire University for several hours, so we had to postpone our visit and come back after lunch.  Even then, all of the doors were locked for another hour, so we had to hang out for a while until they got the all clear and let us go shop in the bookstore.  Seriously, when was the last time you got to experience TWO bomb threats in one week?  Didn't I mention "excitement"?

And you'll only be able to tell those captivating stories if you attend this exciting launch of the new dedicated Dynamics GP partner conference.  There will be presentations for sales, marketing, consulting, and developer roles, so there will be something for everybody.

So register now at the reIMAGINE2014 web site.  Then book your flight to scenic Fargo and make that hotel reservation.

I hope to see you there!

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter



Product Recommendation: SQL Prompt by Red Gate Software

By Steve Endow

If you have been using SQL Server Management Studio for several years, you probably know that its Intellisense feature sometimes doesn't work.  I've had it work well on some machines, intermittently on other machines, and on some servers, it just doesn't work at all no matter what I try.  Even when it does work, it is sometimes slow and not always helpful.

While talking to the famous Victoria Yudin, the developer of GP Reports Viewer, she showed me a handy tool that she uses called SQL Prompt, from the well known company Red Gate Software.

Victoria showed me how it provided fast, reliable, and very full featured Intellisense within SQL Management Studio.  Here's an example.


It is very responsive, so as you type each character, it immediately displays and filters its results.  And in addition to showing you the proposed object names for the word you are currently typing, it also displays additional related information--so in the example above, in addition to listing the RM tables, it displays the fields in RM20201 with their data types.

It also supports "snippets", which are shortcuts that are automatically converted into larger SQL statements with a press of the Tab key.  In this example, if I type "ssf" and press Tab, it converts it to "SELECT * FROM" and then displays a list of tables.


This morning, when I was working on the eConnect AP apply script, I just typed "EXEC taRMApply" and it automatically wrote the parameters for the stored procedure.


That "auto code" feature right there saved me several minutes of tedious typing or copying and pasting of the parameters, and the resulting formatting is clean and easy to work with.

After trying it for just a few days, I'm a believer.  But there are two small downsides.  First, it isn't free--the license is currently $369.  While this seems like a very reasonable price for such a powerful and refined tool, I can understand if that is a little expensive for a typical GP consultant or VAR.

The second issue is one that I face with several specialized tools that I use:  Once you get used to using it and relying on it, you will be frustrated if you have to work on a server that doesn't have it, such as on a client's SQL Server.  I use the UltraEdit text editor, and it drives me nuts when I don't have it on a machine and have to clean up several thousand rows of data.

But aside from those two small caveats, it looks like a great utility.

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter


Importing Dynamics GP AR Apply records using SQL

By Steve Endow

I was working with a customer this morning who had recently imported and posted 2,800 AR cash receipts.  Only after posting the cash receipts did they realize that the payment applications for those cash receipts did not import.

Since Integration Manager doesn't allow you to import just payment applications, we had to come up with a way to import the 2,800 AR payment applications.

A few years ago, I developed an eConnect integration that imported AR cash receipts and automatically applied them to open invoices.  But since the client already had the payment application data, that was overkill--we just needed a way to import the applications without any additional fancy logic.

Rather than deal with a .NET application, I figured we could just use the eConnect RM Apply stored procedure--taRMApply.  If we imported the AR payment application data into a SQL staging table, a SQL script could loop through the apply records and call the taRMApply procedure for each.  Sounded easy, but I was afraid there would be a catch somewhere.

So I created an initial SQL script that would read the apply data from the staging table into a cursor, loop through that cursor, and call taRMApply.  It turned out to be surprisingly simple and clean.  And I was able to easily update each record of the staging table to indicate whether the apply was successful, and if not, record the error from eConnect.

Here is the SQL Script that I created, which I have also shared up on my OneDrive in case  you want to download it instead.

The script assumes you have a staging table with a unique row ID, the necessary apply from and apply to values, and an imported flag field and an importstatus field.  You can adjust the table names, fields, and field names to suit your needs.

One last note--the ErrorString output from the taRMApply procedure is going to be an error number.  You can lookup that number in the DYNAMICS..taErrorCode table to get the related text error message.

You will want to test this yourself, and make sure to perform an initial test on a Test database first, but it appears to have worked well.  It took maybe a minute or or two so to apply the 2,800 payments based on an initial test, so it appears to be fairly fast.

To my pleasant surprise, the process went smoothly, and other than a small error in the script that we quickly fixed, it worked well.

If you find any errors in the sample script below, or have any suggestions for improving it, please let me know.


/*
7/24/2014
Steve Endow, Precipio Services
Read RM payment application data from a staging table and apply payments to open invoices

sp_help RM20201
sp_help taRMApply
*/

DECLARE @RowID INT
DECLARE @ApplyFrom VARCHAR(21)
DECLARE @ApplyTo VARCHAR(21)
DECLARE @ApplyAmount NUMERIC(19, 5)
DECLARE @ApplyFromType INT
DECLARE @ApplyToType INT
DECLARE @ApplyDate DATETIME
DECLARE @ErrorState INT
DECLARE @ErrorString VARCHAR(255)

SELECT @ApplyDate = '2014-07-24'

--Get data from staging table
DECLARE ApplyCursor CURSOR FOR
SELECT RowID, ApplyFrom, ApplyTo, ApplyAmount, ApplyFromType, ApplyToType FROM staging WHERE imported = 0

OPEN ApplyCursor

--Retrieve first record from cursor
FETCH NEXT FROM ApplyCursor INTO @RowID, @ApplyFrom, @ApplyTo, @ApplyAmount, @ApplyFromType, @ApplyToType

WHILE @@FETCH_STATUS = 0
BEGIN

       --Perform apply
       EXEC dbo.taRMApply
              @I_vAPTODCNM = @ApplyTo, -- char(21)
              @I_vAPFRDCNM = @ApplyFrom, -- char(21)
              @I_vAPPTOAMT = @ApplyAmount, -- numeric
              @I_vAPFRDCTY = @ApplyFromType, -- int
              @I_vAPTODCTY = @ApplyToType, -- int
              @I_vDISTKNAM = 0, -- numeric
              @I_vWROFAMNT = 0, -- numeric
              @I_vAPPLYDATE = @ApplyDate, -- datetime
              @I_vGLPOSTDT = @ApplyDate, -- datetime
              @I_vUSRDEFND1 = '', -- char(50)
              @I_vUSRDEFND2 = '', -- char(50)
              @I_vUSRDEFND3 = '', -- char(50)
              @I_vUSRDEFND4 = '', -- varchar(8000)
              @I_vUSRDEFND5 = '', -- varchar(8000)
              @O_iErrorState = @ErrorState OUTPUT, -- int
              @oErrString = @ErrorString OUTPUT -- varchar(255)

       --Check for success
       IF (@ErrorState = 0)
              BEGIN
                     --If apply was successful
                     UPDATE staging SET imported = 1, importstatus = '' WHERE RowID = @RowID
              END
       ELSE
              BEGIN
                     --If apply failed
                     UPDATE staging SET imported = 0, importstatus = @ErrorString WHERE RowID = @RowID
              END

       FETCH NEXT FROM ApplyCursor INTO @RowID, @ApplyFrom, @ApplyTo, @ApplyAmount, @ApplyFromType, @ApplyToType

END

CLOSE ApplyCursor
DEALLOCATE ApplyCursor

 

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter


Wednesday, July 16, 2014

Dynamics GP Web Services does not support importing sales taxes for SOP Sales Orders

By Steve Endow

I just spoke with a customer who is trying to use Dynamics GP Web Services to import SOP Sales Orders.

He needs to import header level taxes for the sales orders, but was unable to do so--he would get an error about the amount being incorrect.  He had read a forum post indicating that Web Services did not support sales taxes, so he didn't know if he was doing something wrong with his import, or if it was a limitation of Web Services.

I recommended that he contact support, as that would be the quickest way to either determine that sales taxes were not supported, or find the issue with his import.

He contacted MS support and confirmed that Dynamics GP Web Services does not support the import of sales taxes for Sales Orders.  Apparently this is true for GP 10, 2010 and 2013.  He was told that Web Services does support the import of sales taxes for SOP Invoices, but not for SOP Sales Orders.

I'm assuming there is some reason for this, but it seems baffling.  eConnect supports the import of sales taxes for orders, so I don't understand why web services wouldn't have similar support for taxes on orders.  And why Invoices are supported but Orders are not is similarly puzzling.

I guess that's one more reason why I won't be using Web Services.  I'm just not a fan.

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter



Tuesday, July 15, 2014

Oldie But Goody- Users When Logging in to Test Companies

This is a pretty common issue, but I thought it was worthwhile to post a summary of the issue and the (relatively) easy fix.

First, the scenario...
  1. You set up users in GP (Admin Page-Setup-User)
  2. You don't want users accidentally testing in the live company, so you limit their access to the Test company only (Admin Page-Setup-User Access)
  3. This works great until you refresh the Test database with a copy of the Live database
  4. Now the users can't access the Test company, and receive a variety of errors on the SY_Current_Activity table
This is due to the fact that the users have access to the test DB per the GP setup, but the database itself does not have the users attached to it (once restored from Live).  If you attempt to remedy this in GP through Admin Page-Setup-User Access, you will usually also receive errors if you attempt to unmark/remark access to the Test company.

So, it's a relatively easy three part fix...(as always test this out, have a backup, yadda yadda yadda)
  1. In SQL Server Management Studio, first expand the Test company database, then expand Security, then expand Logins.  Make sure the user in question is NOT listed. If they are, delete the user.
  2. Next in SQL Server Management Studio, expand the overall Security folder, and expand Logins.  Right-click on the affected user and choose Properties.  Then click on the User Mapping page.  Unmark the access to the Test database in the upper part of the User Mapping window.
  3. Log in to GP, and navigate to Admin Page-Setup-User Access.  Select the affected user, and remark the access to the Test company
Now, to avoid this in the first place...
  1. Give users access to both the live and test versions of companies (not just the test versions), Admin Page-Setup-User Access. 
  2. Control their ability to enter in to the Live company by not giving them a security role, Admin Page-Setup-User Security.
Christina Phillips is a Microsoft Certified Trainer and Dynamics GP Certified Professional. She is a senior managing consultant with BKD Technologies, providing training, support, and project management services to new and existing Microsoft Dynamics customers. This blog represents her views only, not those of her employer.

Project Types in Dynamics GP- Not Always What They Seem

My entry point to Dynamics GP, about 14 years ago, was Project Accounting.  It was the first I learned, and I lived the lessons of how hard it is change course once you have something set up.  In my career as a consultant, I have witness many a Project Accounting implementation gone awry.  And in my naive younger days I would judge the prior consultants, thinking how they must not have understood how Project works.  But over time, I have come to understand that the issue often is a matter of definitions and communication.

When I sit down and ask a client to describe their projects, they will often use terms like "time and materials" or "fixed price" or "cost plus".  And it can be tempting in those moments to immediately correlate that to the GP terms.  I mean, they are identical, right?  GP has Fixed Price, Cost Plus, and Time and Materials projects.  But, hold up...

When clients/users describe their projects, they often are talking in terms of how they bill the project (and the corresponding contract terms).  While in GP, the difference in project types is more about revenue recognition and how billing amounts are calculated.  So it is important to dive deeper in to the project type discussion to avoid setting up unnecessarily complicated projects. 

Let's break it down by the attributes of each project type, starting with most complicated to least (in my humble opinion)...

Cost Plus
  • Fee plus allowable (billable) expenses
  • Can include project fee (lump amount), retainer fee (amount paid in advance) or retention (amount withheld from billing)
  • Billing calculated as percent complete (Forecaster vs Actual) based on profit type of budget items
  • Revenue Recognition calculated per accounting method (Based on percent complete, or when project completed).  Will not recognize when billed.
Fixed Price
  • Fixed fee only
  • Can include project fee (lump amount), retainer fee (amount paid in advance) or retention (amount withheld from billing)
  • Billing calculated as percent complete (Forecaster vs Actual) based on profit type of budget items
  • Revenue Recognition calculated per accounting method (Based on percent complete, or when project completed). Will not recognize when billed.
Time and Materials
  • Can include both fees allowable (billable) expenses
  • Can include project fee (lump amount), retainer fee (amount paid in advance) or service fee (fee amount recognized over time)
  • Billing is calculated based on profit type of budget items and scheduled fee dates (not percent complete)
  • Revenue is recognized on expenses and project fees based on the accounting method, either when the expense is posted or when it is billed (not percent complete)
  • Service fees are the only feature of Time and Materials projects to require revenue recognition, and they recognize based on duration (you enter a start and end date for the fee)

As you read through the list, I want you to note specifically the impact of revenue recognition and billing on the project type.  If you do NOT recognize revenue on a percent complete, if you do it when you bill...then your projects may be Time and Materials by GP standards.  If you bill specific amounts at specific times, rather than progress bill based on percent complete, then your projects may be Time and Materials by GP standards.  Perhaps you need to recognize revenue over time, not based on budget -vs- actual, then you may be a Service Fee on Time and Materials in GP.

The lesson here is to not take the terms at face value, and to make sure you understand the impact of the choice in GP (not just what you call it internally, or per the contract terms).

Christina Phillips is a Microsoft Certified Trainer and Dynamics GP Certified Professional. She is a senior managing consultant with BKD Technologies, providing training, support, and project management services to new and existing Microsoft Dynamics customers. This blog represents her views only, not those of her employer.

Friday, July 11, 2014

Help!!! My Dynamics GP SQL Server is out of disk space!!!

By Steve Endow

ZOMG!  Your SQL Server only has 8 MEGABYTES of disk space left!!!  What do you do???


Obviously, there are many reasons for a full disk--maybe there are extra database backups, or a bunch of large files that are consuming disk space.

But, if you have considered those obvious suspects and already dealt with them, and your SQL Server data disk is still full, what do you do?

I just had a call with a customer who had 8 MB of free space on a 250 GB drive.  The drive was dedicated to SQL Server and only had databases on it.  Obviously 250 GB is not very large by today's standards, and you could argue that a larger disk would help, but in the short term, we had to deal with the full disk, and as you'll see, 250 GB is plenty of space for this customer's data.

There are a few ways to diagnose the problem, but I like to start with a fantastic tool called WinDirStat.  It scans one or more drives, lists files and folders based on how much space they consume, and also provides a visual representation of the files consuming the most space on the drive.


For this customer, we knew that the 250 GB drive only had SQL Server databases on it, but WinDirStat showed us how much space each mdf and ldf file was consuming.

We saw that there were three databases where the the log file was 19.6 GB, but the database was only 18 GB.  It turns out that one of those databases was the production company database, and the other two were test databases--copies of the production database.  So a backup of production was restored into two test companies, resulting in three copies of the nearly 20 GB SQL log file.

We also saw that the tempdb database was 44 GB!  See my post about Dynamics GP and tempdb if you want to learn more about tempdb.  As we now know, simply restarting the SQL Server service will recreate the tempdb, which would save over 40GB of disk space.

But what about those large log files?  Well, when a SQL log file is larger than the Dynamics GP company database, or even when it grows to several gigabytes, I typically bet that the log file is mostly empty and doesn't need to be that large (for applications other than Dynamics GP, this may not be the case).

Transaction logs are used to record database activity that occurs between SQL Server backups.  As the activity occurs, the transaction log will typically grow automatically as needed.  This is fine.  But sometimes there is a ton of activity--say the customer imports thousands of historical transactions--which causes the log file to grow abnormally large.

When the next SQL Server backup occurs, the log file will be cleared out, but by default, the log file will not shrink.  So the log file may be 20 GB, but only 10 MB of that file may actually be used--it's essentially empty, but it still consumes 20 GB of disk space.

So how can you tell?  There are probably a few better ways, but I like to go into the SQL Server Management Studio Shrink Files window.  Right click on the database, select Tasks -> Shrink -> Files.


When the Shrink File window opens, change the File type to Log.


Notice that the log file in this screen shot is 20 GB, but 99% empty.  This was for a training copy of the Dynamics GP company database.

After clicking OK in this window, SQL Server shrank the log file down to 20 MB, instantly freeing up 20 GB of disk space.  It took less than a second.  While I don't believe that the test database log shrink operation in this particular case had a performance impact, I would recommend that any similar operations on a production database be performed after hours, just in case.

The client repeated this process on another test GP database, and another 20 GB was freed up, producing a total of 40 GB of free disk space.  When they have a chance to shrink the log file for the production company database after hours, that total will increase to 60 GB of free disk space.

And once they restart SQL Server and tempdb is recreated, that should free up another 40 GB, giving them 100 GB of free disk space.

So from 8 MB to 100 GB of free disk space in just a few minutes without having to delete a single file.  That 250 GB hard drive is now looking pretty spacious.

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter


Wednesday, July 2, 2014

GP 2013 R2 changes to User Setup window

By Steve Endow

I installed GP 2013 R2 last week and am slowly encountering a few changes and new features.

One change that jumped out at me was the redesigned User Setup window.

GP 2013 SP2:



GP 2013 R2:


Obviously the R2 window has the rather "prominent" ribbon at the top, but aside from that global change in R2, the User Setup window has a few interesting additions.

User Type:  Full vs. Limited.  A Limited user is apparently "restricted to inquiries and reports" only.  And if the user is a member of the POWERUSER role, you cannot change the user from Full to Limited.  As such, you cannot change the sa or DYNSA logins from Full to Limited.

Web client user only:  This allows you to specify that the user is for the web client only, and will use their Windows account to login rather than a SQL login.

There are now two tabs on the window--one for SQL Server Account info, and the other to specify a Windows Account for web client users.

Last, there is a Home Page Role field.  The help file explains:
Assign the user to a user role. The user role determines the content that is displayed on a user’s home page by default.
On my install, that field is disabled, so I don't know if I am missing some configuration options, or if that is a future feature.


Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter



Unlocking a SQL Server login without resetting the password

By Steve Endow

I had a call with a consultant who was having trouble unlocking a SQL Server login.  While trying to login to GP Utilities with the sa login, he used the wrong password and ended up locking out sa.

Not a big deal, but when he went into SQL Sesrver Management Studio to unlock the sa account, he received this message:


"Reset password for the login while unlocking"

I never use the SQL password policy option on my development SQL servers, so I never lock out accounts, but apparently SQL Server requires that you reset the password in order to unlock the account.

A quick search returned this helpful workaround on MSSQLTips.com:  If you uncheck the Enforce password policy option and save the login, it will disable the account lockout.  He tried unchecking the Enforce password policy checkbox, and was able to login to GP Utilities just fine.  He then went back and re-checked the Enforce password policy box.

I don't understand why the password policy option and account lockout option are linked like that, but I learned something new today.


Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter



SQL Server WHERE clause wildcards

By Steve Endow

This morning I was working on a SQL query used to create to create new Dynamics GP customer IDs.

The customer IDs are created by using the first 6 characters of the customer name, followed by 3 numbers.  For example:

ACMETO001 - Acme Tools
ACMETO002 - Acme Tooling, Inc.

To query these customer IDs, I was using this query:

SELECT CUSTNMBR FROM RM00101 WHERE CUSTNMBR LIKE 'ACMETO%'

In this example, the query would return two records, so I knew that the next customer ID needed to be "ACMETO003".

This appeared to work fine.

Except this morning, the client found that they had a customer name with less than 6 characters, in which case this query did not work properly.

ACME001 - Acme

If I use the same query, it would look like:

SELECT CUSTNMBR FROM RM00101 WHERE CUSTNMBR LIKE 'ACME%'

Well, the problem is that this query will pick up the ACMETO001 and ACMETO002 IDs as well, and my new customer ID routine would improperly think that this is the next ID:

ACME003

This is not correct--it should be ACME001.

So how do we query all "ACME" customer IDs without including "ACMETO" customer IDs?

I had a general idea, but I hadn't used it in quite a while.  After searching for regular expression options and wildcards, I was reminded that the SQL LIKE clause supports basic regex-like wildcards.

This MSDN page discusses the SQL like clause and its wildcard options.  If you use brackets [ ], you can specify characters that you want to search for, or that you do not want to search for.  Additionally, you can use the underscore character to represent any character.

In my case, I came up with this:

SELECT CUSTNMBR FROM RM00101 WHERE CUSTNMBR LIKE 'ACME[0-9][0-9][0-9]%'

Since I know that the "ACME" customer ID will always have 3 digits on the end, I'm able to use the [0-9] wildcard three times to represent those three digits.  So the query will now pick up all ACME customer IDs, but will not pick up any ACMETO customer IDs.

The % at the end is probably not really necessary anymore, but I left it in the statement for now.

Now go and impress your friends and neighbors with this wonderful SQL trick!


Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is also the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter




Tuesday, July 1, 2014

Does Dynamics GP use the tempdb database? No? Yes? Prove it!

By Steve Endow

I received an interesting email today with this statement:
"TempDB has no performance impact on Dynamics GP, as it does not use TempDB."

I had to read that a few times to make sure I wasn't mis-reading it.

So, let's have a show of hands:

How many people believe that Dynamics GP does not use the SQL Server "tempdb" database?

How many people believe that GP does use tempdb?

Perhaps a better starting question:  Who knows what the SQL Server tempdb is?

Let's start with the last question:  What is tempdb?  I suspect that many people don't know since tempdb typically operates in the background where most users, and even some DBAs may not even be aware of its existence.  Folks that are fairly technical with SQL Server and software developers that write SQL should be at least familiar with tempdb.

According to this MSDN article, tempdb is a global system database that holds certain temporary objects, such as local temp tables, temp stored procedures, variables, or cursors.  It is also used for "work tables to store intermediate results for spools or sorting", and several other SQL Server operations.  These features are critical for almost any application that uses SQL Server--not just Dynamics GP.

A few points to note about the physical characteristics of tempdb.

From that MSDN article:
tempdb is re-created every time SQL Server is started so that the system always starts with a clean copy of the database.
I didn't know this until today and never really thought about it before.  I think it's interesting and informative in case you ever have to diagnose or troubleshoot an issue related to tempdb.  However, while testing this with Dynamics GP, I believe that this statement is technically incorrect--from what I can tell, all temporary objects are disposed from tempdb, but non-temporary or "permanent" objects can persist in tempdb even when SQL Server is restarted (examples to follow).  It is not as if all tables in tempdb are dropped when SQL Server is restarted.

However, for "permanent" tables that are stored in tempdb, it appears that the contents of those tables will be wiped when the SQL Service is restarted.  This is a pretty interesting "feature" that I'll get back to below.

Another point:
Temporary tables and stored procedures are dropped automatically on disconnect, and no connections are active when the system is shut down. Therefore, there is never anything in tempdb to be saved from one session of SQL Server to another.
So when you close Dynamics GP and close out your SQL Session, any temp tables or temp stored procedures should be removed. (GP consultants will know that this isn't always the case)

So after that brief review of tempdb, what is your answer now?  Does Dynamics GP use the tempdb database?

A politician might say:  It depends on your definition of "use"!  Well, let's settle that definition.

If you view the contents of the tempdb database on a SQL Server being used for Dynamics GP, you will quickly see two physical tables:  DEX_LOCK and DEX_SESSION.

Both of those tables are used by Dynamics GP.  I'd say that qualifies for "use".

Next, check out the contents of the tempdb database on an active Dynamics GP SQL Server.  This list of temporary objects is just from one user logging into Dynamics GP, with no other activity.  That's 7 temp tables and 37 temp stored procedures, JUST FOR LOGGING IN!


Additional temp tables and temp stored procedures will be created as you perform additional processes in GP, and old temp objects will be removed.

These are just the application level objects that we can easily see in SQL Management Studio, but I would say this alone clearly shows that Dynamics GP relies heavily on tempdb.

So, now that we know that GP uses tempdb, so what?  Who cares?  Why does it matter?

Well, normally it shouldn't matter, and normally we shouldn't really care too much.  But, there are times when you are troubleshooting Dynamics GP problems, and in some instances, understanding how Dynamics GP uses tempdb may be valuable.

For instance, many consultants will be familiar with the topics discussed in these KB articles:

Remove all the inactive sessions from the DEX_LOCK

Error message when you post a batch in the general ledger

In both of these cases, you may need to clear the contents of one or both of the DEX tables in the tempdb database.

And what if Dynamics GP takes 12 minutes to login?  Perhaps tempdb could be involved in that performance problem?

Hopefully that answers some questions you may have had, or didn't know you had, about Dynamics GP and tempdb.  But I have one final question:

Why does Dynamics GP use the tempdb for the DEX_LOCK and DEX_SESSION tables?  Well, as I mentioned earlier, "permanent" tables in tempdb will automatically have their contents cleared when SQL Server is restarted.

So while it is somewhat unconventional to create application-specific tables in the tempdb database, such tables do have the interesting benefit of being cleared whenever SQL is restarted or the server is rebooted.  That is a handy feature for the DEX_LOCK and DEX_SESSION tables, as I can see wanting those tables to always be empty after a SQL restart.

So now you hopefully know more than you ever wanted to know about Dynamics GP and tempdb.  Go forth and be the life of the party!


Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is also the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter