Thursday, February 14, 2008

Stonefield Query 3.2 in Beta

Stonefield Query 3.2 is now in beta. Here are some additional changes we made this week:

  • The Desktop Image configuration property was removed since Stonefield Query no longer has a background window to display it in.
  • The SQApplication object has a new CanEditReports property you can set to False to prevent the user from creating or editing reports under certain conditions (for example, perhaps demo users should only run existing reports).
  • The Import Report function now handles invalid files better.
  • You now get a warning message if you open a report in the Advanced Report Designer that has an image file that no longer exists or has been moved to a different folder. The image is replaced with a placeholder that you can edit to correct the file location.
  • The Configuration Utility no longer terminates after you've activated it.
  • Changing the connection settings for a database from ODBC to VFP no longer gives a Locate DBCXREG dialog when you refresh the database.
  • The properties page for a database in the Configuration Utility now includes settings for Add All Tables to the Data Dictionary, Include Views, and Prompt for Subtables. Formerly, these settings were only available in the Add Database dialog, making it difficult to use different settings when you refresh the database.
  • Including two enumerated fields with the same name (for example, RECTYPE from two different tables) in a report no longer displays blank values for the second field.

Monday, February 11, 2008

Additional Stonefield Query 3.2 Changes

Stonefield Query 3.2 is due for release on March 1, 2008. This week, we made some of the last changes before testing begins:

  • Stonefield Query no longer has a background screen. All dialogs now appear directly on your Windows desktop and can be moved around independently.
  • The report wizards are no longer modal. This means you can modify more than one report at a time if desired.
  • Line spacing is now correct in labels that have fields in larger fonts.
  • You no longer get an error if you choose Copy or Edit from the File menu when the Template Editor is open.
  • You can no longer open multiple instances of the Template Editor.
  • The correct controls are now displayed in the Options page of the Reports Explorer when it is the current page and you change from a Label report to a different type or vice versa.

Monday, February 4, 2008

The Latest Build

We added several new features and fixed a number of bugs in the last three weeks.

  • The Cross-Tab, Label, and Chart wizards now have an Advanced button that brings up the same dialog available in the Quick Report Wizard to specify TOP value, customize the SQL statement for a report, or specify code to execute at certain places for the report.
  • You can now specify that a field should go into the group header for another field. For example, suppose you group on City from the Customers table but want to show the Region in the group header as well. If you turn on the Include all fields in same table in group header option in the Group page in the Field Properties dialog, all fields in the Customers table will appear in the group footer, which isn't what you want. Instead, turn the new Include this field in the group header for setting on and select City from the drop-down list to place just City and Region in the group header. Since all fields that appear in group headers now appear in summary reports, Region will no longer be excluded from such a report.
  • The Options dialog has a new Locations page where you can easily change the location where reports are stored.
  • The Setup dialog now prompts you for your email settings. These are needed to email reports. However, many people don't realize they need to set these settings in the Options dialog so they can't email reports.
  • You can now select specific reports to export or export all or some of the reports in a specific folder. The Export All Reports function in the File menu was renamed to Export Reports; selecting it now displays a dialog from which you can select which specific reports or folders to export. The Export Report function in the File menu was renamed to Export Selected Report.
  • You can now edit the security properties for a folder by selecting the folder and clicking Edit in the Reports Explorer.
  • The Information page in the Reports Explorer now show what groups the selected report or folder is available to.
  • Importing a report that uses a data group that doesn't exist any more (for example, it was renamed) no longer makes the report invisible but instead resets the data group to All.
  • Renaming a user in the Maintain Users and Groups dialog automatically moves all their reports to the new name.
  • The Commonly Used Expression drop-down in the Expression Builder now only shows common expressions that match the data type of the expression being built. For example, the common date expressions now only appear for date expressions. Also, a new First Day of Previous Month expression was added.
  • A splash screen can now appear when Stonefield Query starts up if you create an image named SPLASH.BMP, JPG, JPEG, or PNG that you want displayed in the splash screen.
  • You can now distribute customized Standard and Elegant templates in the Sample Templates folder. Previously, the internal versions of these templates were always used.
  • Returning False from the DataEngine.GetCustomMetaData script now terminates Stonefield Query so you can close the application if you detect a problem in such a script.
  • Grand totals at the end of the report no longer appear on a second line if they will fit on the first one.
  • The Generate Setup function in the Configuration Utility no longer gives an "Inno Setup is not installed" error if you installed only the Inno Quick Start Pack and not the full Inno Setup.
  • A bug that gave an error when running a report with a filter from a text data source was fixed.
  • A bug that prevented case-insensitive filters when the filter Compare to setting is set to Field was fixed.
  • A bug that sometimes caused the login dialog to appear off-screen so you couldn't see it was fixed. For details, see
  • A bug that caused a field needed by a link action to appear in both the available and selected lists in Step 2 of the Quick Report Wizard was fixed.
  • A bug that sometimes caused a filter condition to be mangled if it contained a single quote (for example, SomeField = 'Barney's Store') or a pair of empty quotes (for example, SomeField = '') was fixed.
  • The cFilter property of the loReport object is now set to the filter for the report.

Friday, February 1, 2008

Displaying Company Header Information


Yesterday, a customer asked me how to handle a single record "Company" table. The single record in this table contains information about the Company that is using the software, like the Company Name and the Address. So, if we here at Stonefield were looking at our entry in that table, the Company Name field would contain "Stonefield Software Inc.", and the Address field would be "2323 Broad Street".

The question becomes, "How do we get this information into our reports?". When I first ran across this situation, my initial reaction was to simply create a join/relationship with that table and every other table in the database. There are a couple of problems with doing it this way:

  • We don't have a field in the table to join on, so the join would need to be an expression that evaluates to true.
  • If the database has a large number of tables, creating a relationship with all of them would be impractical.
  • Having to include this company information in the data selection step of Stonefield Query's report wizards would be very clumsy. The information would repeat itself over and over again at the detail level. Information like this generally belongs in the header of a report.

A better way to handle this situation is to use a script that looks this information up for us and stores it in a global variable. Here is an example of such a snippet from a GetCustomMetaData script:

*variable declarations 
public gcAddress, gcCompanyName
local lnSelect, loDatabase, lcSelect
*store the current work area
lnselect = select()
*get a reference to the database we are currently connected to
loDatabase = SQApplication.DataEngine.Databases.GetMainDatabase()
lcSelect = "select CompanyName, Address from Customers"
*send the SQL statement to the database
loDatabase.ExecuteSQLStatement(lcSelect, .NULL., 'curCompanyCursor')
*store the address and company name we just retrieved
gcAddress = curCompanyCursor.Address
gcCompanyName = curCompanyCursor.CompanyName
*restore the workarea
select (lnselect)

Once this is done, we have two global variables (gcAddress and gcCompanyName) that we can reference from the output expression of a field object in the advanced report designer. We could even reference these from a template, and have company information like name and address appear in the header of every report by default.