Home » Developer & Programmer » Forms » Copy/Paste by Trigger
() 1 Vote
|
|
|
Re: Copy/Paste by Trigger [message #184560 is a reply to message #183666] |
Thu, 27 July 2006 01:21 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
If you have 'Keep Cursor Position' set to 'TRUE' for this field, pressing a button which navigates to another field (go_item), does a Copy_Region then does a go_item back to your original field, and finally does a Paste_Region, should place the copied data at the place where you had your cursor.
Please post the code associated with your button.
David
[Updated on: Thu, 27 July 2006 01:22] Report message to a moderator
|
|
|
|
|
Re: Copy/Paste by Trigger [message #193868 is a reply to message #193093] |
Tue, 19 September 2006 14:29 |
itroome
Messages: 34 Registered: June 2005 Location: DUBAI, UAE
|
Member |
|
|
Salam
Here is example of Copy and Paste for the Mutiple Records
Copy
DECLARE
RecCopyGrpName varchar2(30) := 'CopyWAWERecGroup' ; --Record group name
RecCopyGrpId RecordGroup ; --Record Group Id.
GrpCopyColId GroupColumn ; --Group column id.
RowCounter number := 1 ;
C_Block Varchar2(100);
C_Record Number;
C_Item Varchar2(100);
BEGIN
if get_block_property('HrmPmsWaPayDef', update_allowed) = 'TRUE' then
----------
C_Block:= :System.Cursor_Block;
C_Record:=:System.Cursor_Record;
C_item:= :System.Cursor_Item;
RecCopyGrpId := find_group(RecCopyGrpName) ;
--
--If a record group with this name dosn't exist then create record.
--
if not id_null(RecCopyGrpId) then
delete_group('CopyWAWERecGroup') ;
end if ; --if not id_null(RecGrpId) then
--
RecCopyGrpId := create_group(RecCopyGrpName,global_scope) ;
GrpCopyColId := add_group_column(RecCopyGrpId,'WAWENO',CHAR_COLUMN,10) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'PWAGEELEMENT',NUMBER_COLUMN,10) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'WEID',CHAR_COLUMN,30) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'WENAME',CHAR_COLUMN,30) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'WEDESCR',CHAR_COLUMN,200) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'WETYPE',CHAR_COLUMN,30) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'VALMETHOD',CHAR_COLUMN,30) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'USERINPUT',NUMBER_COLUMN,30) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'PRFORMULA',NUMBER_COLUMN) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'OPFORMULA',CHAR_COLUMN,4000) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'WELEVEL',CHAR_COLUMN,1) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'STATUS',CHAR_COLUMN,1) ; --DB
--
go_block('HRMPMSWAWE') ;
first_record ;
--
loop
-- message('HrmOpsResponsibilities:'||:HrmOpsResponsibilities.selection) ;pause ;
Add_Group_Row(RecCopyGrpId,RowCounter) ;
Set_Group_Char_cell('CopyWAWERecGroup.WAWENO',RowCounter,:HrmPmsWAWE.WAWENO) ;
Set_Group_Number_cell('CopyWAWERecGroup.PWAGEELEMENT',RowCounter,:HrmPmsWAWE.PWAGEELEMENT) ;
Set_Group_Char_cell('CopyWAWERecGroup.WEID',RowCounter,:HrmPmsWAWE.WEID) ;
Set_Group_Char_cell('CopyWAWERecGroup.WENAME',RowCounter,:HrmPmsWAWE.WENAME) ;
Set_Group_Char_cell('CopyWAWERecGroup.WEDESCR',RowCounter,:HrmPmsWAWE.WEDESCR) ;
Set_Group_Char_cell('CopyWAWERecGroup.WETYPE',RowCounter,:HrmPmsWAWE.WETYPE) ;
Set_Group_Char_cell('CopyWAWERecGroup.VALMETHOD',RowCounter,:HrmPmsWAWE.VALMETHOD) ;
Set_Group_Number_cell('CopyWAWERecGroup.USERINPUT',RowCounter,:HrmPmsWAWE.USERINPUT) ;
Set_Group_Number_cell('CopyWAWERecGroup.PRFORMULA',RowCounter,:HrmPmsWAWE.PRFORMULA) ;
Set_Group_Char_cell('CopyWAWERecGroup.OPFORMULA',RowCounter,:HrmPmsWAWE.OPFORMULA) ;
Set_Group_Char_cell('CopyWAWERecGroup.WELEVEL',RowCounter,:HrmPmsWAWE.WELEVEL) ;
Set_Group_Char_cell('CopyWAWERecGroup.STATUS',RowCounter,:HrmPmsWAWE.STATUS) ;
RowCounter := RowCounter + 1 ;
--
exit when :system.last_record = 'TRUE' ;
next_record ;
end loop ;
--
Go_Block(C_Block);
Go_Record(C_Record);
Go_Item(C_Item);
--
:Parameter.Copy:='Yes'; -- Check that Data has been Copied.
else
message('Update is not Allowded') ;
end if ; --if get_block_property('HrmPmsWaPayDef', update_allowed) = 'FALSE'
exception
when others then
message(sqlcode||sqlerrm) ;
--
END;
---------------------------
--------------------------
Paste
DECLARE
RecCopyGrpName varchar2(30) := 'CopyWAWERecGroup' ; --Record group name
RecCopyGrpId RecordGroup ; --Record Group Id.
GrpCopyColId GroupColumn ; --Group column id.
RowCounter number := 1 ;
C_Block Varchar2(100);
C_Record Number;
C_Item Varchar2(100);
BEGIN
if get_block_property('HrmPmsWaPayDef', update_allowed) = 'TRUE' then
----------
C_Block:= :System.Cursor_Block;
C_Record:=:System.Cursor_Record;
C_item:= :System.Cursor_Item;
RecCopyGrpId := find_group(RecCopyGrpName) ;
--
--If a record group with this name dosn't exist then create record.
--
if not id_null(RecCopyGrpId) then
delete_group('CopyWAWERecGroup') ;
end if ; --if not id_null(RecGrpId) then
--
RecCopyGrpId := create_group(RecCopyGrpName,global_scope) ;
GrpCopyColId := add_group_column(RecCopyGrpId,'WAWENO',CHAR_COLUMN,10) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'PWAGEELEMENT',NUMBER_COLUMN,10) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'WEID',CHAR_COLUMN,30) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'WENAME',CHAR_COLUMN,30) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'WEDESCR',CHAR_COLUMN,200) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'WETYPE',CHAR_COLUMN,30) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'VALMETHOD',CHAR_COLUMN,30) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'USERINPUT',NUMBER_COLUMN,30) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'PRFORMULA',NUMBER_COLUMN) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'OPFORMULA',CHAR_COLUMN,4000) ; --Query
GrpCopyColId := add_group_column(RecCopyGrpId,'WELEVEL',CHAR_COLUMN,1) ; --DB
GrpCopyColId := add_group_column(RecCopyGrpId,'STATUS',CHAR_COLUMN,1) ; --DB
--
go_block('HRMPMSWAWE') ;
first_record ;
--
loop
-- message('HrmOpsResponsibilities:'||:HrmOpsResponsibilities.selection) ;pause ;
Add_Group_Row(RecCopyGrpId,RowCounter) ;
Set_Group_Char_cell('CopyWAWERecGroup.WAWENO',RowCounter,:HrmPmsWAWE.WAWENO) ;
Set_Group_Number_cell('CopyWAWERecGroup.PWAGEELEMENT',RowCounter,:HrmPmsWAWE.PWAGEELEMENT) ;
Set_Group_Char_cell('CopyWAWERecGroup.WEID',RowCounter,:HrmPmsWAWE.WEID) ;
Set_Group_Char_cell('CopyWAWERecGroup.WENAME',RowCounter,:HrmPmsWAWE.WENAME) ;
Set_Group_Char_cell('CopyWAWERecGroup.WEDESCR',RowCounter,:HrmPmsWAWE.WEDESCR) ;
Set_Group_Char_cell('CopyWAWERecGroup.WETYPE',RowCounter,:HrmPmsWAWE.WETYPE) ;
Set_Group_Char_cell('CopyWAWERecGroup.VALMETHOD',RowCounter,:HrmPmsWAWE.VALMETHOD) ;
Set_Group_Number_cell('CopyWAWERecGroup.USERINPUT',RowCounter,:HrmPmsWAWE.USERINPUT) ;
Set_Group_Number_cell('CopyWAWERecGroup.PRFORMULA',RowCounter,:HrmPmsWAWE.PRFORMULA) ;
Set_Group_Char_cell('CopyWAWERecGroup.OPFORMULA',RowCounter,:HrmPmsWAWE.OPFORMULA) ;
Set_Group_Char_cell('CopyWAWERecGroup.WELEVEL',RowCounter,:HrmPmsWAWE.WELEVEL) ;
Set_Group_Char_cell('CopyWAWERecGroup.STATUS',RowCounter,:HrmPmsWAWE.STATUS) ;
RowCounter := RowCounter + 1 ;
--
exit when :system.last_record = 'TRUE' ;
next_record ;
end loop ;
--
Go_Block(C_Block);
Go_Record(C_Record);
Go_Item(C_Item);
--
:Parameter.Copy:='Yes'; -- Check that Data has been Copied.
else
message('Update is not Allowded') ;
end if ; --if get_block_property('HrmPmsWaPayDef', update_allowed) = 'FALSE'
exception
when others then
message(sqlcode||sqlerrm) ;
--
END;
|
|
|
Goto Forum:
Current Time: Fri Sep 20 10:32:50 CDT 2024
|