Skip to content
Home » Company » Sample applications and example code » WebQuery for DataFlex

WebQuery for DataFlex

WebQuery is a view you can include in your own Visual DataFlex 17.1 (or higher) WebApp programs to provide users with an ad hoc reporting capability.

WebQuery – Some history

WebQuery is a reimplementation (circa Nov 2013) of Sture Andersen’s VDFQuery Windows utility as a VDF 17.1 WebApp Framework (WAF) component. As well as taking its inspiration and interface design from Sture’s VDFQuery, it also relies very heavily on a number of his other offerings: StructFunctions, TableQuery, XmlBuilder and his experimental ExpressionParser.

WebQuery for DataFlex was originally developed entirely using the VDF Studio and required only two minor additions to the standard Data Access Web Application Framework.

WebQuery – Getting Started

WebQuery now exists as two work spaces on DataFlexCode on GitHub – the original DF 17.1 version and a more recent DF 20.0 version.

To create reports and see the benefit of integrating them with your DataFlex applications, simply download the WebQuery utility version you want from GitHub.

Log in to WebQuery

To use WebQuery you must first log-in (File -> Log In)… but who to log-in as? Well, thanks to weak management, sloppy programming and inexcusably poor product testing, a pair of reports have been left on the Reports menu accessible to un-logged-in users: the ’Users List’ will give you the required information. In addition, some pre-defined reports require more elevated rights to appear on the menu – again, the ’Users List’ will help you out here.

The data included in the sample workspace is that from the VDF 17.1 WebOrder sample (with a few additions to the WebAppUser table and some of the customer balances adjusted to make for more interesting things to report on).

Choosing the data for your WebQuery report

WebQuery allows you to create reports on multiple tables based on the relationships defined in your database – once a ’Main Table ’ has been selected all of the tables to which that table relates, all the way up the relationship tree, will be available to you. Note: you must select a Main Table as the first step in creating a report (or load an already defined query).

You can choose columns (except Overlap or Binary type columns) from any of the tables to output and also to use as the basis for record selection. You can also use calculated fields (expressions) and a single selection expression. You can chose to total (’Sum’) on numeric fields and can split rows in your reports over multiple lines using the ’CR’ feature, which will start a new line with that field.

Selections can be made using a number of selection operators, including string inclusion or exclusion, ranges (included or excluded) or lists of values. You can order your report by any of the main table’s defined indices, or select the ’Ad hoc index’ option to define your own ordering, which can then be based on fields from related-to tables as well as the main table. (Warning: this may result in slow running reports.)

Formatting your WebQuery report

You can define breakpoints in the report which will cause the printing of sub-headings at the beginning of each section and sub-totals at the end of them (the latter assuming you are totalling on at least one field).

You can specify multi-line fixed text to appear both before and after your report.

You can select the font typeface and size, specify the colours of the text, background and alternate-row highlight (if used), choose to include the selection critera and record count in the report, or to print only totals. Finally you can select the output destination and format.

Controlling who can see WebQuery reports and data

Reports can be saved as ’Public Queries’ or as private to the logged in user.

If the ability to see all of the data in the database seems too great a capability to grant to your users, you can programmatically exclude entire tables, or just certain columns, from being visible within the WebQuery interface.

Alternatively you can use WebQuery without making it available to your users by omitting it from the menus (or perhaps by setting the required rights higher than you grant them), but still use it to provide them with reports which you build with it. There are several examples of such reports in the ’Reports’ menu above (more once you log in).