Re: Question DES/2K, constrains

From: Jacek Dobosz <jdob_at_nospam.ping.at>
Date: 1997/05/21
Message-ID: <33835343.17264984_at_news.ping.at>#1/1


On Sat, 17 May 1997 08:14:05 GMT, infoad_at_xs4all.nl (InfoAd - Jurrian Beuker) wrote:

>
>I am Jurrian Beuker from holland. I develop software with Form V3.0
>and ReportWriter 1.1. (in Holland) At this moment i'm using designer
>for the first time, and i have two (small i think for you) questions :
>
>When i have 2 table with a 1 to N relation, and i'm bilding a Form
>where the first table gets 4 rows and de second (N) 10 rows and i
>place them om de samen page.
>When i navigate to the second (N) block, i can not see with master
>record belong to these details. If i put the N table on a sepetare
>page, I can include contect items from the master record.
>
>Is there a way to indicate the record in a block with more than 1
>master record with master record is actief if i have moved to the
>detail records ? (in de same page).

There is a new display type _current record_ in des2k v. 1.3.X. Just define a secondary DCU in master block, assign this new display data type, set width and height to 1 and the forms generator will generate the blue rectangle to indicate the current row in master block while you navigate to detail block.

Alternatively, you can write generic when-new-block-instance trigger in the template which will do the similar job:

declare
r_no number;
begin
ro_no := get_block_property( name_in('SYSTEM.CURRENT_BLOCK'),

RECORDS_DISPLAYED );
  if ro_no <> 1 then
    set_block_property( name_in('SYSTEM.CURRENT_BLOCK'),
CURRENT_RECORD_ATTRIBUTE, 'CURRENT_ROW' );
  end if;
end;

>
>My second question is relatied to validation. in a table i have 3
>fields, ID, BEGIN_DATE, END_DATE. all field must be entered. the
>periode between BEGIN_DATE and END_DATE must be uniek.
>
>suppose i have the records :
> ID BEGIN_DATE END_DATE
> 1 1-jan-97 2-mai-97
> 1 1-jun-97 20-jun-97
>There record are valid.
>invalid is
> 1 1-mai-97 20-mai-97
>Becouse this record have 1 en 2 mai in comment with the first record.
>the period my not overlap with a oder period with the samen id.
>

In my opinion, the best job will make the dummy check constraint ( function located on client or server and called with COMPLEX: prefix ), validated on field and commit level, which checks the row uniqueness with select statement and returns true or false.

hope this helps

jacek

+-----------------------------------------+
| if you want to replay, use jdob_at_ping.at |
| or remove nospam from the address       |
+-----------------------------------------+       
Received on Wed May 21 1997 - 00:00:00 CEST

Original text of this message