Undefined attribute [message #195976] |
Tue, 03 October 2006 07:31 |
garyd1
Messages: 4 Registered: October 2006
|
Junior Member |
|
|
What is undefined attribute if it doesn't tell you which attribute is undefined? Where do I go? All I'm doing is loading a drop down combo with stuff from a flat file. The data comes in fine. When I select one of the items I put it in a text box so the user can edit it. Then i have an Update button that writes the whole combo box data back out to the flat file substituting the edited one where it is suppose to be. Here is the code. It bombs at the the TEXT_IO_FOPEN(v_dir_file2, 'W') line with an ORA -302001 error which basically means it can't find the file. But it loaded the combo box from the file and I closed it. I'm stuck.
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 := '';
if (:text_item10 is null) then
:text_item26 := 'Choose a department from the pull down box to put it in the edit box';
else
--IT BOMBS HERE :text_item50 := 'start';
v_file_in2 := TEXT_IO.FOPEN(v_dir_file2, 'W');
-- NEVER GETS HERE :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;
end;
|
|
|
Re: Undefined attribute [message #196209 is a reply to message #195976] |
Wed, 04 October 2006 09:08 |
RJ.Zijlstra
Messages: 104 Registered: December 2005 Location: Netherlands - IJmuiden
|
Senior Member |
|
|
Hi,
I don't think your program / logic will work this way.
After you read file in, and displays the lines, you want to change a line.
But how to get the changed line back in the correct place of the file?
Steps you might try:
1) read the complete file in an associative array.
2) change the element of this ass. array
3) with a host command, delete the original file
4) now write back the contents of the ass. array to a new file that has the name of the original file.
I think this should work.
Question:
Why do you not place the data in a table? Much easier then...
Regards,
Rob Zijlstra
|
|
|
|