Re: Forms 4.5 Create Record
Date: 1997/10/16
Message-ID: <877023432.32363_at_dejanews.com>#1/1
In article <34450FEA.57D1_at_mail.sdsu.edu>, Susan Frady <sfrady_at_mail.sdsu.edu> wrote:
> We have a form with a multi-record block which is
> ordered by date in descending order. When they
> add a record, our users would like to have the new
> record open up at the beginning of the block,
> BEFORE the first record. This is contrary to
> Forms' default processing, which opens the new
> record AFTER the current record. Has anyone done
> this type of workaround (i.e., setting focus to
> record 0)?
>
> Thanks so much for any assistance!
>
> Susan Frady
> Financial Aid Office
> San Diego State University
Susan,
I created a little form to see if I could do it. Briefly, you copy all the values from the first row into temporary variables, create a new record, load it with all the first row's values (including the rowid). Set the new row's status to query or changed as required. Then you go back to the first row, null out all its values and set its status to New.
The wrinkles get ironed out in the on-lock trigger and when-validate-record trigger.
The entire process requires four components:
A procedure or when-button pressed trigger to do the processing
A when-validate-record trigger
An on-lock trigger
A form parameter
I can send the form fmb as an email attachment if anybody wants to try it.
I have included the pl/sql code below.
Steve Cosner
CASA group, CSU Fresno
http://members.aol.com/stevec5088
Procedure P01_Create_Rec_Before IS
-- This works on a block where the block is named 'BLK', which
-- has two columns: Col1 and Col2.
Blk_Col1 Varchar2(20); Blk_Col2 Varchar2(10); rowid_save Varchar2(18); Sts Varchar2(20); BlkNam Varchar2(30) := :System.Cursor_Block;Begin
Validate(Record_Scope);
If not Form_Success then
Raise Form_Trigger_Failure;
End if;
- On any row below the first, all that is needed to do a
- "create-record-in-place" is the following. If Get_Block_Property(BlkNam,Current_Record) > 1 then Previous_Record; Create_Record; Return; End if;
- Store values from current row, to be moved to row below -- Sts := Get_Record_Property(1,BlkNam,Status); rowid_save := :Blk.Rowid; Blk_Col1 := :Blk.Col1; Blk_Col2 := :Blk.Col2;
- Create the new row, and make it look like the old row -- Create_Record; If not Form_Success then Raise Form_Trigger_Failure; End if; :Blk.Col1 := Blk_Col1; :Blk.Col2 := Blk_Col2; :Blk.Rowid := rowid_save; If Sts = 'QUERY' then Set_Record_Property(2,BlkNam,Status,Query_Status); Elsif Sts = 'CHANGED' then Set_Record_Property(2,BlkNam,Status,Changed_Status); Else Set_Record_Property(2,BlkNam,Status,Insert_Status); End If;
- Go back to old row, make it into a new (all null) row
Previous_Record;
:PARAMETER.NOLOCK := 'Y';
:Blk.rowid := null;
:Blk.Col1 := null;
:Blk.Col2 := null;
:PARAMETER.NOLOCK := null;
Set_Record_Property(1,BlkNam,Status,New_Status);
End P01_Create_Rec_Before;
- When-Validate-Record Trigger on Blk
If :Blk.rowid is null
and :System.Record_Status='CHANGED' then
Set_Record_Property(:System.Trigger_Record,'BLK',
Status,New_Status);
Set_Record_Property(:System.Trigger_Record,'BLK',
Status,Insert_Status);
END IF;
- On-Lock Trigger on Blk If :PARAMETER.NOLOCK is null then lock_record; end if;
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Thu Oct 16 1997 - 00:00:00 CEST