Ramiz Tariq
Ramiz Tariq

Reputation: 387

Sequence of When-Button-Pressed Button Oracle Forms

I have "UPLOAD" Button on Oracle Forms in which when user press the button then:

If "Text Item" Field NOT NULL Then

-- Run Upload Procedure From "CSV" File to Oracle Forms

-- Save Data From Oracle Forms to Table in Database

-- Run report in Excel File From SQL QUERY

-- Change the label of Upload Button to "Upload1"

These steps Run Successfully. Code:

IF ( :WE_GROUP_HOF_K.FILE IS NOT NULL ) THEN
EXCEL_UPLOAD;
commit;
REPORT_EXCEL;
Set_Item_Property('Upload',label,'Upload [1]');

END IF;

enter image description here

Now I want these steps When user again Press "UPLOAD" Button:

If Upload Button = 1 Like "Upload 1" THEN

-- Delete from table

-- Upload Again (Run Upload Procedure)

-- Save data into table database

-- Change the label of Upload Button to "Upload[2]"

I tried myself When Upload Button Label "Upload1" Then run 2nd steps but did not solved. Please Provide Solution

Thanks

Upvotes: 1

Views: 500

Answers (1)

Barbaros Özhan
Barbaros Özhan

Reputation: 65218

You can consider using Get_Item_Property method to extract the numeric part for your if statement as

declare
  v_label varchar2(100);
begin
 if ( :we_group_hof_k.file is not null ) then
 begin   
  v_label := Get_Item_Property('Upload',label);
  if regexp_replace(v_label,'(\D)') = '1' then
    Delete from table ...
    EXCEL_UPLOAD;
    Save data into table database ...    
    Set_Item_Property('Upload',label,'Upload [2]');
  else
    EXCEL_UPLOAD;
    REPORT_EXCEL;
    Set_Item_Property('Upload',label,'Upload [1]');      
  end if;
    commit;
 end;   
 end if; 
end;

Upvotes: 1

Related Questions