Home » Developer & Programmer » Forms » writing to flat file problem
writing to flat file problem [message #196278] Wed, 04 October 2006 13:36 Go to next message
garyd1
Messages: 4
Registered: October 2006
Junior Member
Hi,
I am still having considerable problems with this even after suggestions. I have a flat file that is read when the form loads and populates a combo box. The user is to select an item and it is placed into a text box for editing. Then they are to click an update button and it is to write the contents of the list box, substitute the new edited item, and rewrite the flat file. I have tried deleting the file to recreate it. I am using TEXT_IO_FOPEN(filename, 'W'); Here is the rest of the code for the update button that is suppose to write out the file

declare
num number(8);
numinlist number(8);
outvar varchar2(100);
out2filevar varchar2(100);

v_dir_file2 varchar2(100) := '\\City_hall\Ch2_data\HR\Osha\oshaemail.txt';
v_file_in2 TEXT_IO.FILE_TYPE;
cnt number(8);
v_string2 varchar2(100);

begin
num := 1;
:text_item26 := '';
host('cmd /C DEL /Q \\City_hall\Ch2_data\HR\Osha\oshaemail.txt');

if (:text_item10 is null) then
:text_item26 := 'Choose a department from the pull down box to put it in the edit box';

else
:text_item50 := 'start';
v_file_in2 := TEXT_IO.FOPEN(v_dir_file2, 'W');
-- :text_item51 := 'end';
numinlist := to_number(get_list_element_count('LIST4'));

cnt := 1;
while cnt < numinlist
loop

-- read the list box items and check the dept no with the hidden box :text_item16
-- if they are the same, that is the edited one so concatenate the dept no and the
--edited email and put it back, otherwise just write the one in the list box out
outvar := get_list_element_value('LIST4', cnt);
-- message (substr(outvar,1,6) || ' ' || :text_item16 || ' ' || :text_item10, acknowledge);
-- message (substr(outvar,1,6) || ' ' || :text_item16 || ' ' || :text_item10, no_acknowledge);

if (substr(outvar,1,6) = :text_item16) then
out2filevar := :text_item16 || ',' || :text_item10;
TEXT_IO.PUT_LINE(v_file_in2, out2filevar);


else

TEXT_IO.PUT_LINE(v_file_in2, outvar);
end if;
cnt := cnt + 1;
end loop;

TEXT_IO.FCLOSE(v_file_in2);
:text_item26 := 'Email file has been updated with changes';
:text_item10 := '';
-- reload the pull down
num := 1;
CLEAR_LIST('LIST4');
-- sw := 0;
-- write the pdf file names from the c:\oshatemp dir to a file called dir.txt
-- then read each one out and get the dept number off of the file name to send email
v_file_in2 := TEXT_IO.FOPEN(v_dir_file2, 'R');
-- now read the directory listing from the file and call sendmail for each file
-- loop through file called oshaemail in oshaemail dir to find email address by looking up dept no

LOOP
TEXT_IO.GET_LINE(v_file_in2, v_string2);
add_list_element('LIST4', num, v_string2, v_string2);

num := num + 1;
END LOOP;
go_item('LIST4');
TEXT_IO.FCLOSE(v_file_in2);
end if;
:text_item50 := 'reload';
end;


When I run it and go to select something from the pull down i get a whole host of errors:

FRM- 40735 When Button Pressed trigger raised unhandled exception ORA 302000
Then I get FRM 40815 Variable Global.Formname_Display_ind does not exist --- I am clueless as to what this even means
Then I get FRM 40815 Variable Global.User_Interface does not exist
FRM 41011 Undefined variable is another one. What all these errors mean and why they come in one after another when I click the down arrow on the pull down is a great mystery to me. So this is kind of a last ditch effort. If anyone can help great- I would appreciate it. If not I will probably declare this project dead and my supervisor can give it to someone else because I have no clue how to get it to work.
Re: writing to flat file problem [message #196309 is a reply to message #196278] Thu, 05 October 2006 00:01 Go to previous message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

try to change
\\City_hall\Ch2_data\HR\Osha\oshaemail.txt';
into
c:\City_hall\Ch2_data\HR\Osha\oshaemail.txt';
Previous Topic: How to link Business Objects Reports with Oracle Forms apps
Next Topic: Tabs and Executing queries
Goto Forum:
  


Current Time: Fri Dec 09 11:59:12 CST 2016

Total time taken to generate the page: 0.12269 seconds