I get an error pointing to GetData.RecordCount. Whats wrong?
One thing we see not infrequently is a cfdump in our inbox from a perplexed user, pointing to an error in the vicinity of Line 400 in gridmonger.cfm (exactly where depends on how you set up your grid) and pointing to either an empty value in GetData.RecordCount or the complete lack of a variable named GetData.RecordCount -- which one you see will depend on your version of ColdFusion.
GetData.RecordCount is just what it sounds like: A ColdFusion-generated count of the records returned by a query. In this case the main query that populates your grid with data. As such, if the query runs at all it should return some value, right?
Not necessarily, but to save time lets ignore that question and go over what typically causes this error:
- You haven't properly specified or set up your data source. Happens all the time so don't take it for granted that yours is done right.
- You made a mistake in your WHERE clause. Specifically what you wrote in variables.WhereClause contained an error in SQL syntax.
- You mixed up acceptable case in a case-sensitive db platform. This one burns mySQL users, and may affect others. Usually this means the case used in the table name specification and the where clause didn't match (it has to on that platform).
- You made some other database-related syntax or naming error. Being a GridBuilder user makes this a lot less likely, since GridBuilder makes you pick field names from a drop-down list so you can't mispell them, but it can still happen. This means the error is probably confined to the above possibilities and will be easier for you to find.
How Do I Fix It?
Check your data source specifications in your GridMonger config files, and in the ColdFusion Administrator. Check your specified WHERE clause. Check your table name vs. WHERE clause case if you are using mySQL. Then check them again. Look for something dumb... it happens to everybody.
If you don't spot the problem, its time to let ColdFusion's native error handling tell you where the problem is. While GM uses try/catch error handling to display friendly error messages, and shows/emails detailed diagnostics, the fact is that in this particular case a raw CF error message will lead you to the problem a lot faster. This is especially true with ColdFusion 6 and 6.1.
Do a global search/replace on the CFTRY and CFCATCH blocks surrounding almost every template in the GM system; commenting them out. Run your grid template again and take note of the raw error generated. It should tell you what you need to know to find and fix the problem. When you spot the error, uncomment the try/catch stuff and you're back in business.
|