Re: Forms 4.5 Rollback 'POST'

From: Neville Sweet <sweet.neville.nj_at_bhp.com.au.no_junk_today_thanks>
Date: 1998/02/18
Message-ID: <01bd3c1e$b8b691e0$45f11286_at_itwol-pc3963.itwol.bhp.com.au>#1/1


Hi Tracey,

Have you considered Clear_Block(NO_VALIDATE)?

If that's inappropriate, what you can do is save the last query criteria, clear_form, set the master block's where clause and then execute_query.

I have used :System.Last_Query to capture the previous query criteria. :System.Last_Query holds the entire where and order by clauses, so we have to strip out what we need:

/* Save Last Query criteria. */

tx_last_query := NULL;
tx_select := UPPER(:System.Last_Query);
no_pos := INSTR(tx_select, 'WHERE');

/* Query criteria previously entered? */ IF no_pos > 0
THEN
  tx_where := SUBSTR(tx_select, no_pos + 6);
  tx_last_query := tx_where;
  no_pos := INSTR(tx_where, 'ORDER BY');
  /* Remove any Order By clause (if applicable). */   IF no_pos > 0
  THEN
    tx_last_query := SUBSTR(tx_where, 1, no_pos - 1);   END IF;
END IF; Clear_Form;

Set_Block_Property(your_master_block,

                   DEFAULT_WHERE,
                   tx_last_query);

Execute_Query;

The default_where clause remains current for the life of the form, so if the form is directly queryable by the user you will have to reset the where clause prior to Enter-Query or in a Pre-Query trigger (conditionally, for new query only). If you don't have a default where clause defined on your master block then set it to an empty string.

If your query returned multiple records then I'm afraid the above won't restore you to the master record you were previously in, unless of course it was the first. You could try saving the current record number and doing a Go_Record.

Tracey Berukoff <tlberukoff_at_boco.co.gov> wrote in article <34EA2A8D.457_at_boco.co.gov>...
> I want to post records as my user enters them, so I can keep some
> running totals and do some validation via SQL (without having to loop
> through all the records in all the blocks). BUT if the user wants to
> cancel all their changes, I want to get rid of all the posted changes.
> It seems like the only way to do this is CLEAR_FORM?? But then I lose
> all the records in my master block, which is a pain because the user has
> to query again to get the same record set they started with. I want to
> clear the form, and then perform the last query that was executed on the
> master block again. Is there a good way of doing this??? Any help is
> appreciated.
>
Received on Wed Feb 18 1998 - 00:00:00 CET

Original text of this message