At 09:10 AM 4/1/2009, Mike Epstein wrote:

I have a form with a scrolling region that I use to edit data.
After the edit, but before the form is closed, I would like to
use a button to refresh the values in the scrolling region by
re ordering the data
In the scrolling region using 2 columns in the region.


Mike,

If you are using the Scrolling Region (or now DB Grid as in your
recent postings), and if the Scrolling Region or DB Grid is based
on a "single table", you can use the cool technique of designing
a "Single Table View" that is editable and can be re-sorted or
refreshed on demand using the following steps and two PROPERTY
commands.

Steps:

00. Start RBG76 or Turbo V-8 for Windows and CONNECT RRBYW15

01. Create a single table view with WHERE ... ORDER BY clause

    -- Example:
    SET ERROR MESSAGE 677 OFF
    DROP VIEW tCustomer
    SET ERROR MESSAGE 677 OFF
    CREATE VIEW `tCustomer` AS SELECT +
    CustID,Company,CustAddress,CustCity,CustState, +
    CustZip,CustPhone,CustFax,ModLevel,LastUpdateDate, +
    LastUpdateTime,LastOrderDate,CustURL,CustEMail, +
    CustStatus,PaymentTerm,CreditLimit +
    FROM Customer +
    WHERE CustState = 'PA' +
    ORDER BY CustState, CreditLimit DESC
    COMMENT ON VIEW `tCustomer` IS 'Customer view for form'

    -- Notice the original sort (CustState, CreditLimit DESC)

02. Now design a form and use Scrolling Region or DB Grid based
    on a single table "tCustomer" view.

03. While in Form Designer, place a "Speed Button" to re-sort
    the updated data set using the following custom EEP.

    -- Speed Button Custom EEP
    -- Start
    PROPERTY TABLE tCustomer CLOSE
    DROP VIEW tCustomer
    CREATE TEMPORARY VIEW `tCustomer` +
    AS SELECT +
    CustID,Company,CustAddress,CustCity,CustState, +
    CustZip,CustPhone,CustFax,ModLevel,LastUpdateDate, +
    LastUpdateTime,LastOrderDate,CustURL,CustEMail, +
    CustStatus,PaymentTerm,CreditLimit +
    FROM Customer +
    WHERE CustState = 'PA' +
    ORDER BY CreditLimit, CustState
    COMMENT ON VIEW `tCustomer` IS 'Customer view for form'
    PROPERTY TABLE tCustomer OPEN
    RETURN
    -- End
    -- Notice the modified sort
    -- ORDER BY CreditLimit, CustState

04. EDIT USING formname
    -- No need to use WHERE ... ORDER BY clause
    -- Data is already sorted using the WHERE BY clause

05. Make desired updates/changes as necessary and if you
    wish to re-sort the displayed data, all you need is
    to click on re-sort speed button. This should re-sort
    the display column based on two columns as defined in
    the modified view statement for Speed Button Custom EEP.

This step-by-step exercise should give you a good perspective
on achieving your goal.

Enjoy and make sure to have fun!

Very Best R:egards,

Razzak.

P.S.
  If you need a sample application to demonstrate the use of
  such techniques and more ... feel free to e-mail me at my
  private e-mail.
P.P.S.
  In addition to sooooo many features in R:eXtreme 9.0 , the
  "Enhanced DB Grid" Control includes options such as:
  . Draw Graphic Field
  . Show Footer
  . Draw Bands
  . Bands Over Titles
  . Show Filter Bar
  . Any Key Filter
  . Frame Hot Track
  And more ...


Reply via email to