Home » Developer & Programmer » Forms » How to Create New Record before First Record in Detail Block after Execute from Database
How to Create New Record before First Record in Detail Block after Execute from Database [message #83681] Wed, 26 November 2003 05:41 Go to next message
Arvind Bhandari
Messages: 50
Registered: May 2003
Member
Hello , we are using FORMS 5.0 for Developing Forms.we have 1 master Detail FORM in which there are 5 Detail of 1 master. Now when Queried the Record and after executing we want to Insert a Record before a first Record in Detail Block.
How can we Insert before 1st Record in Detail Block? We want in a way that the :system.Record_Status of First_Record(ie the Record whcis is creating New)should be New/Insert and the original First Record(which would be shift in 2 Position should be QUERY.
Is there any tricky soluion for that

Thanks if anyone can give solution
Arvind
Re: How to Create New Record before First Record in Detail Block after Execute from Database [message #83698 is a reply to message #83681] Mon, 01 December 2003 07:26 Go to previous messageGo to next message
magnetic
Messages: 324
Registered: January 2003
Senior Member
im afraid there aint a easy way to achieve that.
if you really insist to achive it, i can give you an idea:
the detail block should be a control block and the fields are displayfields [[no database fields]]
In the post-query trigger of the first block you should get the values of the detail block with a select statement and assign each record like
for i in cursordetail loop
:b.field1:=var1;
:b.field2:=var2;
down;
end loop;

before calling the post-query you should add a dummy record in the detail field with a reserverd primary-key.
example table detail(col1,col2,col3)
supose col1 is de PK.
insert into table detail values(1,null,null);
now execute the post-query.
notice that you have to chose a proper PK that should be visible as the first detail record.
the select statement should contain a order by in order to show the dummy record at the first place of the detail block.

This is a soluion but not a clean way of developping.
Re: How to Create New Record before First Record in Detail Block after Execute from Database [message #83716 is a reply to message #83698] Wed, 03 December 2003 04:54 Go to previous message
Arvind Bhandari
Messages: 50
Registered: May 2003
Member
First of all thanks for taking a Interest on such a typical problem. Actually this is not a solution on complicated Forms having 3-4 simultaneously Detail Block against 1 Primary Header Block. and also we have Different Tab Pages against different Block and we have coded programatically to hide_view and show_view on different condition. also we cannot Navigate to Block to Block in Restricted Trigger ie POST_QUERY Trigger. I have tried a one solution ie in KEY-UP trigger of Detail Block we have write a follwing Code
if :system.cursor_record = 1 then

IF :DTEREXP.Exp_Cd is null then
Err('Expense Code Cannot be Blank, or first clear the Record');
ELSE
IF :HTER.Status = 'N' OR :HTER.Status IS NULL THEN
Create_Record;
Duplicate_Record;
Up;
Currec := :System.Cursor_Record;
CurItem := :SYSTEM.CURSOR_ITEM;
:DTEREXP.Exp_Sr_No := :System.Cursor_Record;
:DTEREXP.Exp_Cd := NULL;
:DTEREXP.Exp_Desc := NULL;
:DTEREXP.Exp_Grp_Cd := NULL;
:DTEREXP.Exp_Grp_Desc := NULL;
:DTEREXP.Exp_Amt := NULL;
:DTEREXP.VCH_ATCH_YN := 'N';
:DTEREXP.Exp_Remarks := NULL;
SET_FORM_PROPERTY(:SYSTEM.CURRENT_FORM,VALIDATION,PROPERTY_FALSE);
Arrange_Rownum_EXP('DTEREXP',Currec,CurItem,'FALSE');
SET_FORM_PROPERTY(:SYSTEM.CURRENT_FORM,VALIDATION,PROPERTY_TRUE);


ELSE
Err('At First Record');
END IF;

END IF;

else
up;
:g_blk_msg.error_msg := null;
end if;

but in this case the :SYSTEM.Record_Status of Ist Record become Changed and IInd Record become INSERT and if we think logically :SYSTEM.RECORD_STATUS of Ist Record(ie Top Record which is created before Ist Record) should be INSERT and IInd Record should be CHANGED.

Arvind
Previous Topic: Size of a Global variable
Next Topic: Color palettes, FMB->XML and XML->FMB
Goto Forum:
  


Current Time: Wed Apr 24 01:46:00 CDT 2024