Stephen,

This is how you sort a scrolling region in a form.
Create a temporary view of the table you want to display in the scrolling
region:

CREATE TEMPORARY VIEW vDistView AS SELECT * FROM dist_file ORDER BY district
ASC

Now create your form and use the newly created view for the scrolling
region.
While designing your form go to LAYOUT>>On Before Design Action and add a
custom EEP

--  On before Design Action EEP
SET ERROR MESSAGE 677 OFF
DROP VIEW vDistView
SET ERROR MESSAGE 677 ON
CREATE TEMPORARY VIEW vDistView AS SELECT * FROM dist_file ORDER BY district
ASC
RETURN

This will allow to edit your form without having to redefine the view every
time.
Now, create a Speed Button or whatever type you prefer and create a custom
EEP:

-- Button to sort scrolling region custom EEP
PROPERTY TABLE vDistView 'CLOSE'
DROP VIEW vDistView
SET VAR vDefineView = ('CREATE TEMPORARY VIEW vDistView AS SELECT * ' +
& 'FROM dist_file ' +
& 'ORDER BY district  ASC' )
&vDefineView
PROPERTY TABLE vDistView 'OPEN'
RETURN

Make sure you use whatever column(s) you want for the new order.
Now, when you click the button, the scrolling region will be sorted
according to the new criteria, no need to mess with unclosed forms.

Add a custom EEP on the Form On Close for housekeeping:

--  On Close Form Custom  EEP
SET ERROR MESSAGE 677 OFF
DROP VIEW vDistView
SET ERROR MESSAGE 677 ON
RETURN

And that's all there is to it. You can tailor it to suit your needs or
instead of using a button, you can add the modified code to the On Exit from
a field EEP, and whenever you select a column, on exiting the field the
scrolling region will re-sort. 

FWIW, I am getting away from scrolling regions and switching to enhanced
grids; a lot more capabilities.

Let me know if you have any questions.

Javier,

Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stephen
Markson
Sent: Tuesday, September 17, 2013 1:21 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: sort scrolling region

Hi list,

I've answered my own question. My form is a single table form, so I can use
the following as my button eep:

EXITFORM
EDIT USING formname ORDER BY othercolumn RETURN

An interesting point: EXITFORM (or CLOSEWINDOW) does not actually close the
form window. If I move the newly sorted form, the old form is visible
although it cannot be accessed. Repeatedly pressing the re-sort button and
moving the form leaves all of the forms visible. Then when you actually do
exit the form, they all disappear.



Regards,

Stephen Markson
The Pharmacy Examining Board of Canada
416.979.2431 x251

From: [email protected] [mailto:[email protected]] On Behalf Of Stephen
Markson
Sent: September-13-13 5:14 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - sort scrolling region

Hello,

Can I dynamically change (i.e. using a button on the form) the sort order of
a table in a scrolling region? Or do I need to use a DB Grid? Thanks for
your help.


Regards,

Stephen Markson
The Pharmacy Examining Board of Canada
416.979.2431 x251


Reply via email to