Home » Developer & Programmer » Forms » Import CSV directly into FORM 6 and d2kwutil and reading from file (win_api_file.read_file)(merged)
Import CSV directly into FORM 6 and d2kwutil and reading from file (win_api_file.read_file)(merged) [message #296844] Tue, 29 January 2008 04:37 Go to next message
pc131
Messages: 36
Registered: May 2006
Member
Hi

I know that this topic in not new, but maybe my case is a bit different than common.

My form has multi-record block (4 columns) in which i want to upload CSV file.

The form will have "Browse..." button to piont CSV file (on local users disc, not where Forms server resides) after pointing the CSV file, user will press UPLOAD button which will import CSV data into block. After that data is visible in block. But whole form must not be refreshed.

I'm studying about UTL_FILE package, but it seems it allows manipulating files on server not local user's machines. Do Forms have such "Browse... -> UPLOAD" possibility or I need to learn Java and create Java funcionality inside Forms?

Or it is impossible to load data directly into form? (I have to use SQLoader and load data into temp table then into block on form????)

Any help will be appreciated.
Tom

[Updated on: Tue, 29 January 2008 06:41]

Report message to a moderator

Re: Import CSV directly into FORM [message #296940 is a reply to message #296844] Tue, 29 January 2008 09:56 Go to previous messageGo to next message
pc131
Messages: 36
Registered: May 2006
Member
Sorry for replying my own topic, but i'm really in need of solution...

Any help form anyone? This is not common situation. I cannot use sqldr because many users will upload files (and i wont have rights to run programs on unix where oracle resides), and sqldr can upload into tables one specified file. Moreover i feel like better solution is to point CSV file using Brows... button, and then import data from CSV straight into form (no sqldr no tables...)

Anyone has idea on this?

[Updated on: Tue, 29 January 2008 09:57]

Report message to a moderator

Re: Import CSV directly into FORM [message #297038 is a reply to message #296940] Tue, 29 January 2008 23:43 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What version of Forms are you using? Search this forum for 'text_io'. You will have to use either 'd2kwutil' or 'web_util' to get Forms to open a file from the browser platform.

David
icon4.gif  Re: Import CSV directly into FORM 6 [message #297104 is a reply to message #297038] Wed, 30 January 2008 02:52 Go to previous messageGo to next message
pc131
Messages: 36
Registered: May 2006
Member
Hi

Thanks for interest

I am using Forms 6 (deployed on web), ok i'll search for text_io and web_util

Tom

========================

I'm afraid webutil won't go with Forms 6

[Updated on: Wed, 30 January 2008 03:55]

Report message to a moderator

icon4.gif  d2kwutil and reading from file (win_api_file.read_file) [message #297198 is a reply to message #296844] Wed, 30 January 2008 10:39 Go to previous messageGo to next message
pc131
Messages: 36
Registered: May 2006
Member
Hi Oracle Gurus

I am using Oracle Forms 6i and i have to use D2KWUTIL.PLL library for file manipulation. I did dialog window to chose file, I succesfully loaded its name into PL/SQL but i have trouble using WIN_API_FILE.READ_FILE function, do you have any examples of code to read lines from file? It will be CSV file separated by ";" lines ended by Enter(CHR(10))

So far I have:

declare
	
filename varchar2(256); -- full path to file
filemode1 char := 'R'; --for read
file1 win_api.file_type; -- file type variable
raise_exc BOOLEAN := FALSE; --not sure here
buffer1 varchar2(100); --not sure here
read_file1 BOOLEAN := FALSE; --reading file
bytes_read number(2); --not sure

begin
	
filename := WIN_API_DIALOG.OPEN_FILEEX('Choose File...','%HOMEPATH%','details.csv |details.csv|');
file1 := WIN_API_FILE.OPEN_FILE(filename, filemode1, raise_exc); --works here i can later put full path on dialog

read_file1:=WIN_API_FILE.READ_DATA(file1, buffer1, 19, false, bytes_read, raise_exc); -- errors

WIN_API_FILE.CLOSE_FILE(file1, raise_exc);
msg('The chosen file is: '||CHR(10)||CHR(10)||filename||CHR(10)||CHR(10)||buffer1);

end;


And this code produces error in runtime ORA-06503:

which says

Error:
ORA-06503: PL/SQL: Function returned without value

Cause:
You tried to call a PLSQL function, but the function was missing a RETURN statement.

Everything went fine until i tried to read from file, putting dialog with just full path number works.

Anyone can help? Web_Util won't work with Forms 6i so i'm stacked to d2kwutil.... How to read from text file???

Thanks in advance
Tom
Re: Import CSV directly into FORM 6 [message #297265 is a reply to message #297104] Wed, 30 January 2008 22:36 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
That's why I OR'ed 'd2kwutil' with it.

Also look at Samples 'File Upload Utility' in http://www.oracle.com/technology/sample_code/products/forms/index.html As you are using Forms 6 you should also look at the 'Forms 6i Developer and Forms 6i Services Demos' entries via the link lower on the page.

David
Re: Import CSV directly into FORM 6 [message #297278 is a reply to message #297265] Wed, 30 January 2008 23:50 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Please don't start new threads for the same topics.

David
Re: Import CSV directly into FORM 6 and d2kwutil and reading from file (win_api_file.read_file)(merged) [message #555959 is a reply to message #296844] Wed, 30 May 2012 03:49 Go to previous message
halim
Messages: 100
Registered: September 2008
Senior Member

hi ,

Download your solution from below link.

http://halimdba.blogspot.com/2012/05/how-to-importinsert-data-from-csvexcel.html

you can find here a 6i forms , csv file and necessary steps....
just download and connect with scott and create a temp table. the run and test.

Thanks&Regards
Muhammad Abdul Halim
http://halimdba.blogspot.com
Previous Topic: FRM-40600 error
Next Topic: ORA-01036: illegal variable name/number
Goto Forum:
  


Current Time: Sun Dec 04 02:48:03 CST 2016

Total time taken to generate the page: 0.10069 seconds