>Hi All
>I've got a table driven Report shell form that I would like to add the capability to change a reports sort sequence at run-time (after selecting a report). Possibly click on a button to open a grid form showing all the Indexes available for the report selected. The user would click on the Index desired and click a close button. Then the form would sort the Cursor using the Index selected.
>Has anyone done this in vfp9?
>All help appreciated.
>Bill Wright
I define for each report what sort orders are appropriate. For most reports, having different sort orders is NOT appropriate, but for a few simple listings, it makes sense to give this option.
Here is an example, for a hypothetical list of clients. The user can select to sort by client code, or by lastname.
local lnSortOption, lcSortOrder
lnSortOption = ThisForm.OpgSort.Value
do case
case lnSortOption = 1
lcSortOrder = "ClientCode"
case lnSortOption = 2
lcSortOrder = "LastName"
endcase
select * from Client;
order by &lcSortOrder;
into cursor Temp
report form ...
Of course, you can adapt this to select among available fields, available indices, etc.; or have tables that define the sort orders that make sense for each table, so the user can select them.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)