Home » Developer & Programmer » Forms » FRM-50016 Legal Characters are 0-9 -+E Error Oracle Forms
FRM-50016 Legal Characters are 0-9 -+E Error Oracle Forms [message #675453] Sun, 31 March 2019 03:33 Go to next message
rehmankhan
Messages: 22
Registered: July 2018
Junior Member
I created Oracle Form in which user "Browse" the "CSV" file from target and target link will we appear in Text Field Item. After user press save button and column values will be read from "CSV" File and Show column values into Data Block. For this purpose I used Client_OLE2.create_obj('EXCEL.Application') Procedure.

In "CSV" File Some Columns Like This Before Adjust Width:

4th Column "6E+09"

https://i.stack.imgur.com/UxSwc.png

After Adjust width Like This:

Now 4th Column Value "6000000116"



https://i.stack.imgur.com/aRmpi.png

After adjust the column width it did not save the file after adjust width.

My Code:


DECLARE 
application   Client_OLE2.Obj_Type; 
workbooks     Client_OLE2.Obj_Type; 
workbook      Client_OLE2.Obj_Type; 
worksheets    Client_OLE2.Obj_Type; 
worksheet     Client_OLE2.Obj_Type;
worksheet2    Client_OLE2.Obj_Type; 
cell                    Client_OLE2.OBJ_TYPE;
args                    Client_OLE2.OBJ_TYPE;
cell_value      varchar2(100);
num_wrkshts     NUMBER;
wksht_name      VARCHAR2(250);
eod                     boolean:=false;
j                       integer:=1; 
BEGIN 

IF ( :WE_GROUP.FILE IS NOT NULL ) THEN 

    -- The following sets up communication with the excel spreadsheet
    -- --------------------------------------------------------------
    -- Open the OLE application
    application := Client_OLE2.create_obj('EXCEL.Application'); 
    -- Keep the application hidden
    Client_OLE2.set_property(application,'Visible','false');

    workbooks := Client_OLE2.Get_Obj_Property(application, 'Workbooks');
    args := Client_OLE2.CREATE_ARGLIST;

    -- Open the selected File
    -- ----------------------
    Client_OLE2.add_arg(args,:WE_GROUP.FILE); 
    workbook := Client_OLE2.GET_OBJ_PROPERTY(workbooks,'Open',args);
    Client_OLE2.destroy_arglist(args);

    worksheets := Client_OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');

    -- Get number of worksheets
    -- ------------------------
    num_wrkshts := Client_OLE2.GET_NUM_PROPERTY(worksheets, 'Count');
    worksheet := Client_OLE2.GET_OBJ_PROPERTY(application,'activesheet');

    --Go to the first record
    go_block('WE_GROUP_HOF_K'); 
    first_record; 

    loop
            If :system.record_status <> 'NEW' then
             create_record;
            end if;

    exit when eod;

        for k in 1..29 loop  --3 fields per record
            args:= Client_OLE2.create_arglist;
            Client_OLE2.add_arg(args, j);
            Client_OLE2.add_arg(args, k);
            cell:= Client_OLE2.get_obj_property(worksheet, 'Cells', args);
            Client_OLE2.destroy_arglist(args);
            cell_value :=Client_OLE2.get_char_property(cell, 'Value');

    --Could be done this way also -> 

    /*if k =1 then
        :dept.deptno:=cell_value;
    end if;

    if k =2 then
        :dept.dname:=cell_value;
    end if;

    if k =3 then
        :dept.loc:=cell_value;
    end if; 
    */

            --Less code this way ->
            copy(cell_value,name_in('system.cursor_item'));
            next_item;

        end loop; --for

        j:=j+1;
    end loop;--main loop

    -- Release the Client_OLE2 object handles
    IF (cell IS NOT NULL) THEN 
        Client_OLE2.release_obj(cell);
    END IF;
    IF (worksheet IS NOT NULL) THEN 
        Client_OLE2.release_obj(worksheet);
    END IF;
    IF (worksheets IS NOT NULL) THEN 
        Client_OLE2.release_obj(worksheets);
    END IF;
    IF (worksheet2 IS NOT NULL) THEN 
        Client_OLE2.release_obj(worksheet2);
    END IF;
    IF (workbook IS NOT NULL) THEN 
        Client_OLE2.release_obj(workbook);
    END IF;
    IF (workbooks IS NOT NULL) THEN 
        Client_OLE2.release_obj(workbooks);
    END IF;
    Client_OLE2.invoke(application,'Quit');
    Client_OLE2.release_obj(application);
ELSE
    Message('No File selected.');
    message(' ');
    RAISE Form_Trigger_Failure;
END IF;
END; 


Now when I press save button then I am getting following error:

FRM-50016 Legal Characters are 0-9 -+E

How to solve this problem? Oracle Forms 11gR2
Re: FRM-50016 Legal Characters are 0-9 -+E Error Oracle Forms [message #675456 is a reply to message #675453] Mon, 01 April 2019 03:24 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
6E+09 is something excel does when the column isn't wide enough. It's got nothing to do with how the data is actually stored in the file.
If you want to be sure what data is in the file open it in a text editor (eg notepad) instead of excel.

So what ever forms is actually complaining about, it almost certainly isn't that.
It'll be some other non-numeric data in an item you've set as numeric.

You need to debug and find out which column and which row is causing the error.
Wrap the copy call with an exception handler that'll display cell_value, system.cursor_item and system.cursor_record.
Re: FRM-50016 Legal Characters are 0-9 -+E Error Oracle Forms [message #675473 is a reply to message #675456] Mon, 01 April 2019 23:46 Go to previous messageGo to next message
rehmankhan
Messages: 22
Registered: July 2018
Junior Member
cookiemonster wrote on Mon, 01 April 2019 03:24
6E+09 is something excel does when the column isn't wide enough. It's got nothing to do with how the data is actually stored in the file.
If you want to be sure what data is in the file open it in a text editor (eg notepad) instead of excel.

So what ever forms is actually complaining about, it almost certainly isn't that.
It'll be some other non-numeric data in an item you've set as numeric.

You need to debug and find out which column and which row is causing the error.
Wrap the copy call with an exception handler that'll display cell_value, system.cursor_item and system.cursor_record.
I tried with "NOTEPAD" and Client_OLE2.set_property(application,'Visible','true');

Notepad did not open. When I use Excel then Excel Application open.
Re: FRM-50016 Legal Characters are 0-9 -+E Error Oracle Forms [message #675477 is a reply to message #675473] Tue, 02 April 2019 03:22 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
When I say open it with notepad I mean exactly that.
I don't mean use forms in any way.
I mean use notepad directly to see the contents of the file.
Re: FRM-50016 Legal Characters are 0-9 -+E Error Oracle Forms [message #675478 is a reply to message #675477] Tue, 02 April 2019 04:05 Go to previous messageGo to next message
rehmankhan
Messages: 22
Registered: July 2018
Junior Member
cookiemonster wrote on Tue, 02 April 2019 03:22
When I say open it with notepad I mean exactly that.
I don't mean use forms in any way.
I mean use notepad directly to see the contents of the file.
In notepad contents are correct. Contents are not correct only open with excel file
Re: FRM-50016 Legal Characters are 0-9 -+E Error Oracle Forms [message #675480 is a reply to message #675478] Tue, 02 April 2019 04:17 Go to previous message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
And that's a thing excel does when displaying the data. It has zero effect on how the data is stored. So forms shouldn't see it.
But to be sure you need to debug it and find out what value cell_value has when it errors out. I already told you how.
Previous Topic: Importing csv file columns data into Data Block Using Oracle Forms
Next Topic: FRM-50026 date must be entered in a format like DD-MON-YYYY
Goto Forum:
  


Current Time: Thu Mar 28 11:14:11 CDT 2024