Onepax Business Consulting


Whether its myself or some other person performing the installation/implementation of a SyteLine ERP system you can bet the farm that somewhere in conversation this table was mentioned as one that needs to be kept neat and orderly.   Hopefully everyone has a SQL Agent job or Execute TSQ task in their maintenance plan that keeps this clean but it’s not always clear to customers as to how and why this table gets dirty and why the frequency of the task may not always be weekly but in many cases could be hourly (yes this is not a typo!).

Infor has meticulously thought out their SyteLine product very well to ensure that data going into their system has proper referential integrity and as a result there are fewer and fewer data scrubbings that now occur between version upgrades.  For those that used to be on the Progress based versions of the software and then upgraded, there was a lot of clean-up.  Job routings could easily exist for jobs that do not exist and item location records could exist for an item that did not exist.

Many of these issues were brilliantly resolved through check constraints, foreign keys, and cascading triggers so now there is little to no chance of duplication on critical values such as vendor numbers, customer numbers, order numbers, and invoice numbers.   Now comes the fun part: ensuring that the next value for a particular sequence can be obtained quickly when a function is called to ask for the “next in sequence” value.

The idea behind NextKeys is actually quite brilliant and when the table is clean, functions can snap the current value for a particular table/column value with lightning speed without performing a table scan.  SyteLine will both read the values from this table and also add more current values as they change but one thing it will not do is perform an automatic real time purge of old values each time a function requests the most current value.  The reason it does not delete the value is not an oversight by the creators but a safeguard to ensure that this is performed outside of a nested transaction so that a record lock will not occur and also so that in the event the “next value” was not committed to the database it won’t skip over that value altogether.

Many customers will often ask why their NextKeys table grows so quickly and the stock answer I usually give is that the growth of NextKeys is dictated not only by frequency of the sequences changing by a human but also many developers will write mods that utilize NextKeys and can contribute massive amount of records to this table in short order via automated tasks.

There are two combinations of data that comprise NextKeys:

TableColumnName + KeyPrefix should be 100% distinct (no duplicates) and should have only the the most current KeyID present(assumes subkey is not present) 


TableColumnName + SubKey should be 100% distinct (no duplicates) and should have only the most current KeyID in the list (assumes KeyPrefix is not present)


In the above example of an uncleaned NextKeys table you will see that co.co_num with KeyPrefix of S has many KeyID’s.  There are 23 duplicates visible on the screen that after running PurgeNextKeysSp should leave one single record for this combination with a KeyID value of 194828.

Here is the same query after running the built in stored procedure to purge:


Notice how for each table/column  key prefix there is only one KeyID that holds the most current (highest) value?   This is what we want to see occur for performance reasons.   Since this is a HEAP table, it’s especially important to keep it free of excessive clutter.

Product documentation describes the best practice of purging unneeded records from this as a nightly task.  For most people I completely agree with this.  There are some exceptions where mods that automate the insertion of records into this table will bloat it very quickly and for those customers who pass the threshold of over 2000 inserts per hour I would probably look into executing the PurgeNextKeysSp stored procedure multiple times per day and in some cases it may even be warranted hourly.   For those who are worried about performing this task in the middle of the day, I would say that it would be highly unlikely for this task to take more than 5-10 seconds and it should not cause a disruption to users in the system like a reindex would cause on SQL Standard which forces many maintenance task to occur offline.

Something that really isn’t talked about too much is that NextKeys are 99.99999% correct for their values but there are certain circumstances where the current value on the NextKeys table is incorrect and desynchronized.  It’s not that someone did something incorrectly in the system that caused it but likely a fluke hiccup resulting from the rare possibility of two getting and setting the NextKeys table at the exact split second and it causes the system to be report a usable next that truly is no longer available.    I saw this more frequently in SyteLine 8.02 and earlier and not so much in 8.03 and newer.   Infor has graciously provided a form called “Synchronize NextKeys” that will go through the process of finding the true value of what the NextKeys should be for each and every combination and assume all the values in this table could be incorrect.  Depending on how many values are in this table it could take from a few seconds to many minutes to complete and should resolve error messages from SQL stating that it cannot insert a record because it already exists with that given combination.

The last nuance to discuss regarding the NextKeys table (and this is actually not specific to this table but any table that is a HEAP) is the bloat, forwarded records, and ghosted records that manifest itself and how to correct.  Eventually I plan to make another article dedicated to this but for now I will simply provide a quick query to determine if the HEAP table suffers from this behavior HERE.  Without going into too much detail you will not want to see any forwarded records, ghosted records or high fragmentation and if you see 10,000+ pages with only a couple hundred records it’s definitely bloated up.   The fix for this only exists in SQL 2008 and newer and you would go into management studio and type


After running that command you should be able to re-run the script to check it and see that everything is now clean, neat, and orderly.

Footnote for DBA’s:

For those of you who want to run the queries I ran to come up with the mathematical logic, here they are for your own curiosity:

select TableColumnName, KeyPrefix, KeyID from NextKeys where SubKey is null and KeyPrefix <> '' order by 1, 2, 3
select TableColumnName, SubKey, KeyID from NextKeys where KeyPrefix = '' order by 1, 2, 3
select count (*) from NextKeys


How many duplicate records can be found in NextKeys:

SELECT TableColumnName
    ,KeyPrefix [KeyPrefix or Subkey]
    ,count(*) TotalCount
FROM NextKeys
    AND KeyPrefix <> ''
GROUP BY TableColumnName
HAVING count(*) > 1
SELECT TableColumnName
    ,SubKey [KeyPrefix or Subkey]
    ,count(*) TotalCount
FROM NextKeys
WHERE KeyPrefix = ''
GROUP BY TableColumnName
HAVING count(*) > 1
    ,2 ASC

  December 31, 2013      Comments (0)

Its this time of year that my buddies in technology take a break from writing SSRS reports, doing forms development in Mongoose, and messing with ERP/EAM entirely and start thinking about all the November and December once a year releases of some of the finest American Whisky (Bourbon specifically) money can buy.   Irish and other whiskeys (think Scotch) are plentiful and available all year long and as long as you have the money, you can likely go to any upscale liquor establishment after you leave the office or manufacturing plant and get a bottle to match your budget.   Sadly, the same does not hold true for Bourbon and that’s why the holiday season is special in more ways than one can imagine.

Camping Out for Bourbon

Just as everyone was camping out for the new Xbox and the Playstation (these are apparently the hot ticket items at the time of writing this),  the lines at the stores waiting for elite Bourbon would make folks think it was a line for the quarterly members only REI gear sale.   Folks from all walks of life would camp out for the chance for a bottle but what makes this long line of customers so interesting is that its filled predominantly with folks in the top 5% income bracket.     Those who scored with Pappy had bragging rights for at least a year and most folks will drink it slowly enough to make it last until next year’s rations.  This isn’t just a top shelf bourbon; this is a private stash only type of bourbon that will only come out if the stakes are high.

In all fairness, I must say that this line of Bourbon has been dramatically hyped up to the level of consumer crazy that is rarely seen.  There are other releases from the same manufacturer and others that also release this time of year that also never make it to the store shelves because they are bought up the second they arrive.  I have no intention of mentioning names but those who follow the releases have a good idea of what other offerings are hot.

This year I was fairly busy with the release of Syteline 9 and going through a half dozen certifications on it and ION so I was fairly excited when I received an email out of the blue from Josh Hiebel from Saratoga Wine Exchange.   While others had left work and were probably eating dinner or relaxing I hear the chime of Outlook telling me I have a new message and the title of it has peaked my interest!

Pappy list

Well here I am all excited because I am actually in front of my PC and see the email and immediately click the button to get on what I think is the waitlist.   My thought was that I was going to be sitting pretty because I knew I was lightning fast to respond and get my name on that list before it became a wasted effort.

Truth be told I was expecting to not hear back for at least a day or two but to my surprise the owner of Saratoga Wine Exchange emailed me shortly after I thought I was putting myself on a waitlist.   Rather than try and summarize it I thought I would simply share the reply that turned my evening from an exciting one to one that made my blood boil


After seeing this, I knew that I fell hook line and sinker for the classic bait and switch.   Somehow the crafty words on his original email that called it an “Allocation List” was strategically ambiguous enough to put readers in the mindset that this must mean waitlist.   This follow-up email was the official kick off of an all out bidding war campaign where the ultimate winner is Joshua Hiebel and the losers are any potential buyers.   This guy not only provides a search engine where you can search up results that only show private individuals selling this product at a huge markup but he does his customers one worse by announcing that he plans to revel the highest offer at the end of the silent bidding war so that people have a chance to pay an even higher premium for the product resulting in more profit to Joshua.   Honestly I think folks would get a far better deal on Craigslist because at least you know that you are going to be paying a premium for the coveted spirit but you know that price upfront and either can opt to buy it or simply ignore.

Joshua did write me back indicating that he sincerely did not intend to alienate his prior customers but did say that we live in a capitalist society where it would be crazy not to try and get top dollar for his goods.   What he does not get is that Buffalo Trace provides this yearly batch as a way to give a great bourbon at a reasonable price while still promoting their brand name for other product lines that are stocked on the shelf year round.   Most of the legitimate places selling it also did not mark it up exponentially to score a huge profit because it was also a huge win for the stores because they got people going to their stores and buying other things and also walking away from the transaction feeling like that store is nothing short of awesome.

Living in Nashville, there was only one time I felt taken advantage of that badly and it was when there was an artificial gas crisis and fuel stations either didn’t have gas or they were selling it at double the price per gallon prior to the incident.   If there is any difference between opportunistic price gouging for gas and having a retailer start a bidding war its certainly very small.   They lost a customer that day but it still hasn’t soured my excitement for this time of year.   In total I have stocked up on four other brands and the silver lining is that I did end up getting called for a true waitlist and was able to buy a 20 year old bottle for $139 which is just about what the retail price should be for this product.  As they say, “All is well that ends well.”   Hope you all have a happy and safe holiday season and look forward to some new cool tips, tweaks, and scripts in 2014.


  December 18, 2013      Comments (0)

Years ago I remember playing with Virtual PC on my laptop and was absolutely amazed with the notion that I could run another operating system just as if it were another Windows application. The speed of the VM images were without a doubt lackluster on my laptop however it gave me hope that one day this would be perfected to a point where business could run multiple servers on one physical box in production.

After many years of hard work and development there are some great software packages on the market by VmWare and Citrix/Xen that virtualization has officially become the standard for deployment of production and development servers. This approach has some distinct advantages, and while it used to be the domain of the big boys like Fortune 500 companies with extensive IT resources, it is becoming common among SMBs as well. Advancing technologies in hardware and software has made it more straightforward to achieve virtualization, and it no longer requires a large IT staff to implement and support.

There can be some great advantages to using ERP applications like Syteline in a virtual server environment.

What is a Virtual Server?

The concept of server virtualization involves running guests instead of physical machines (computers or servers). In the usual (non-virtual) configuration, your computer or server runs one operating system (OS) that makes your computer work and thus a typical Syteline setup will require typically two to three servers. On a PC, it is probably Window XP or Windows 7, for a Mac it is named according to its revision like OS 9 or OSX. Server operating systems are not as well-known outside the IT industry, but Windows, Apple, and LINUX versions are common for servers as well.

In a virtual environment, a single machine has multiple operating systems installed on it, and this is invisible to the operating systems and its users. Each operating system thinks it is operating it own computer – running applications and managing inputs and outputs. Hence, you have several “virtual machines” operating on one single physical machine.

Virtual Software Creates Virtual Machines

Accomplishing this, however, requires special virtualization software that manages the physical machine allowing the various operating systems to run independently and allocating the computing resources to the various operating systems. This software is called the hypervisor or virtual machine manager (VMM).

VMware dominates the market for virtual server (VMM) software with its ESX and ESXi products, plus its Vsphere product focuses on virtualization in a cloud computing environment. Other significant players with virtualization software include:

  • Microsoft Hyper-V and App-V
  • Citrix Systems XenServer
  • Oriole VM and VM VirtualBox

The Advantages of Virtualization

While some IT experts can go on forever about the virtues of virtualization, from a user and business standpoint there are a couple of critical reasons to consider virtualization:

Lower Operating Costs

Using virtualization, organizations can consolidate machines on fewer physical servers. Typically servers are highly underutilized and frequently operate at an average of 15% to 20% capacity. Excess capacity, in the form of expensive physical servers is used to deal with peak application usage that is rarely needed. With a virtual server approach, the same number of virtual servers can exist on much fewer physical servers while providing the same level of functionality and server utilization can be increased to about 80%. Fewer physical servers means less investment in hardware and less ongoing maintenance support.

Tune Operating Systems for Best Application Performance

By running several virtual machines on a single server instead, you can set operating system parameters and settings to suit particular applications and purposes without affecting other applications. Every application can have the OS configured for optimal performance, instead of compromised settings so that other applications installed on a server will run. You don’t need to have expensive separate servers for different applications in order to optimize performance.

Improve and Differentiate Security Settings

We all know that stringent security settings and security software can cause hassles and unforeseen problems. By running virtual machines you can use high security settings for applications or data that need it reduced security settings for applications or users that do not require more stringent security. This can reduce problems for both users and IT administrators while improving security.

Improve Uptime with Automatic Back-up

A virtual machine can divide up a single server into several virtual servers, however, a more practical approach virtualization provides is converting two or three physical servers into a larger group of virtual servers. Now if a physical server is down due to a hardware failure or maintenance, all of the operating systems, applications, and databases continue to function using the remaining servers. Having an automatic backup improves uptime while preventing the loss of data and the use of critical applications like Syteline.

Implementing Syteline in a Virtual Environment

The more complicated the application, the more difficult it can be to implement in a virtual environment. The popular ERP software Syteline can operate in a virtual environment, however some small and medium sized organizations without extensive IT resources hesitate to take advantage of using virtual servers because of the perceived risk. If they have a problem migrating the application to the virtual environment they risk losing the use of a critical application. Having Syteline unavailable for even a short time could be disastrous.

Don’t allow the lack of internal Syteline expertise or IT resources keep you from taking advantage of server virtualization benefits. Using a Syteline expert like Onepax can ensure the migration of Syteline to a virtual server is smooth and flawless. Plus they can help you:

– Optimize and tune Syteline
– Tune Syteline for SQL servers

If you are interesting in talking with a Syteline expert about virtualization or other Syteline needs, contact Onepax.

  December 8, 2013      Comments (0)

Syteline ERP is an outstanding software application that empowers users to stay competitive in the manufacturing sector by offering a base product that is very powerful right out of the box and can be augmented by 3rd party modules for even more functionality.  Most folks won’t argue that the licenses that enable the product and various other features are not exactly cheap but to Infor’s defense, they spent a fortune in time and money creating, supporting, and enhancing these applications with each version.

As a customer, you will want to have a general idea of how many users are truly working on the system to know whether or not you are close to needing to purchase more licenses (or boot out a few users).   The System Administration Home screen provides a great bounce point to go into session management so you can see how many “Syteline Trans” licenses are being used but it will not readily provide the full picture or warn you when the licenses pool is dangerously close to being depleted.

Customers who opt for NAMED licenses have a bit of an easier time with understanding exactly how many of each module is in use because once the module(s) get assigned in the USERS/User Modules linked form they are instantly depleted.   Concurrent licenses are a different story and allow overcommitting of modules to users and only hit their limits when the thresholds of logged in users who are assigned to that given module reach saturation.    I really like concurrent module licensing over named because of this added benefit but it does come at a little bit of a premium in cost.

Wouldn’t it be nice to have a piece of transact sql (TSQL) code that could be used to gather this?  Absolutely!    Well the good news is that Infor does provide a stored procedure that will gather that number when called and with a little ingenuity, it can be called in loop to gather and display all modules.   The original purpose of this script was to help a customer run it on demand so that they could take a few captures throughout the day and report to management as to how close they were to hitting their limits and also whether or not they should purchase more.    I will provide the code below to execute this task on demand and leave it to you guys to tweak it to match your needs.   Some thoughts that come to mind is a SQL Agent Job/Alert that takes the output of this script on a polled interval and emails one or more people in IT or management when they are within X number of licenses from saturation.   This could also be turned into an event as well or it could employ additional logic to boot users out who have been logged in to the system over a certain timeframe.

How many syteline licenses am I using

Results In Uss Results Tab

Licenses In Use Results Tab

One question that folks who download this might be wondering is how to tell from this script alone how close they are to their limit.  The quick answer to that question is that to the best of my ability I do not believe there is a way from TSQL code to get how many licenses of each module are purchased.   The best advice I can give is to open up the form called License Administration and make note of the numbers there.  You can optionally edit this script and populate another column in the temp table with those hardcoded values and perhaps add yet another column to calculate licenses left.  Again, I left this as a general query so that you can use your imagination and make this into code that is useful given the requirements of your company.  If anybody does happy to come up with a way to get the purchased license counts from a query please share with the community.

Update:  A few users had asked whether or not this worked in multisite licensing where either the main site or the master site holds the licenses and passes the license tokens through the intranet.  The answer to this is YES.   Depending on how your multisite is set up this would either be run from the master or run from any one of the sites.  The in use counts should reflect licenses for all sites regardless of where it was run from


  December 7, 2013      Comments (0)