Re: Item syncronization

From: Maurício Bellissimo Falleiros <mbf_at_uniconsult.com.br>
Date: Fri, 15 Oct 1999 14:11:05 -0300
Message-ID: <38076029.888D9891_at_uniconsult.com.br>


Ciao Andrea,

If I have correctly understood, you have a master-detail in the usual way and control-items ItemA and ItemB, right?

You should trap two events:
1) user changes the value of ItemA (if ItemA is a ListBox,

   WHEN-LIST-CHANGED would do the job, for example) 2) user changes record in master block (WHEN-NEW-RECORD-INSTANCE will do)

From both these triggers, you can call a procedure, say MY_SYNHRONIZATION
with the following code (note that there are restricted built-ins, so be careful when choosing the triggers above - the examples I gave are good).

begin

  • there's no record in detail: return back after doing nothing
    --
    if get_block_property('blockb') = 'NEW' then return; end if;
    --
  • synchronize...
    --
    go_block('blockb'); first_record; loop if :itema = a then :itemb := db_field_1; else :itemb := db_field_2; end if; -- exit when :system.last_recod = 'TRUE'; next_record; end loop; first_record; go_block('blocka'); end;

I am not sure if this last go_block command would fire WHEN-NEW_RECORD-INSTANCE on blocka again. This would cause an infinite loop. If so, you should control that with
another control-item or global variable...

Hope this helps you.

Maurício.

-- 
Maurício Bellissimo Falleiros <mailto:mbf_at_uniconsult.com.br>

Uniconsult Sistemas e Serviços <mailto:uss_at_uniconsult.com.br>
R. Demóstenes, 627 cj.134/142 - Campo Belo - São Paulo/SP - 04614-013
Brasil
Fone/Fax: +55-11-5350885 +55-11-5333335

"Em um minuto apenas há tempo
Para decisões e revisões que um minuto revoga."
T.S.Eliot

* Sent from RemarQ http://www.remarq.com * The Internet's Discussion Network *
*  The fastest and easiest way to search and participate in Usenet - Free!   *
Received on Fri Oct 15 1999 - 19:11:05 CEST

Original text of this message