Home » Developer & Programmer » Forms » what's wrong with this code? (db10g,form 6i)
what's wrong with this code? [message #543381] Tue, 14 February 2012 08:44 Go to next message
mughals_king
Messages: 390
Registered: January 2012
Location: pakistan
Senior Member
can anyone tell me why this code generating error "INVALID ITEM OR INVALID ID" my table structure & data as giving below.

TR NAME MANUE_NAME
01 Main
02 Forms
0101 Design DESIGNS
0102 M_PRODUCT PRODUCTS
0103 Sizes SIZES
03 Reports
0301 Lpo Reports
0302 Routine Purchase Report
0303 Sales Report

and WHEN-NEW-FORM-INSTAN CODE

Declare
htree item;
top_node ftree.node
new_node ftree.node;
child_node ftree.node;
child_node ftree.node;
item_code varchar(30);

cursor prim_cur is select tr,name from manue where length(tr)=2;
cursor child_cur(t varchar2) is select tr,name from manue where length(tr)=4 and substr(tr,1,2)=t;
cursor child_cur1(t1 varchar2) is select tr,name from manue where length(tr)=6 and substr(tr,1,4)=t1;

begin
for dummy in prin_cur loop
new_node:=ftree.add_tree_node(htree,ftree.root_node,ftree.parent_offset,ftree.last_child,ftree.expanded_node,dummy.name,'f:\icons\a,' dummy.tr);
for child in child_cur(dummy.tr) loop
child_node:=ftree.add_tree_node(htree,new_node,ftree.parent_offset,ftree.last_child,ftree.expanded_node,child.name,'f:\icons\go',chil d.tr);
for child1 in child_cur1(child.tr) loop
child_node1:=ftree.add_tree_node(htree,child_node,ftree.parent_offset,ftree.last_child,ftree.expanded_node,child1.name,'f:\icons\go', child1.tr);

end loop;
end loop;
end loop;
end;


kindly answer as soon as possible

thanks in advance



[Updated on: Tue, 14 February 2012 08:47]

Report message to a moderator

Re: what's wrong with this code? [message #543382 is a reply to message #543381] Tue, 14 February 2012 08:51 Go to previous messageGo to next message
Michel Cadot
Messages: 59816
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
what's wrong with this code?


First and main point, it is not formatted.

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Quote:
kindly answer as soon as possible


Regards
Michel

[Updated on: Tue, 14 February 2012 08:52]

Report message to a moderator

Re: what's wrong with this code? [message #543388 is a reply to message #543382] Tue, 14 February 2012 09:17 Go to previous messageGo to next message
cookiemonster
Messages: 11207
Registered: September 2008
Location: Rainy Manchester
Senior Member
Once you've formatted it, use messages to determine which exact line is causing the error. In addition post the full error code.
Re: what's wrong with this code? [message #543440 is a reply to message #543388] Tue, 14 February 2012 14:07 Go to previous messageGo to next message
mughals_king
Messages: 390
Registered: January 2012
Location: pakistan
Senior Member
sorry sir i formatted the code but when i applied msg i dont why it
instantly changed i dont know why next time i shall try to post in proper way here is a Error img which i'm uploading.

DECLARE
          htree ITEM;
          top_node FTREE.NODE ;
          new_node FTREE.NODE ;
          child_node FTREE.NODE ;
          child_node1 FTREE.NODE ;
          item_value VARCHAR2(30);
    cursor prime_cur is SELECT RE,NAME FROM MANUE WHERE LENGTH(RE)=2;
    cursor child_cur(T varchar2) is SELECT RE ,NAME FROM MANUE WHERE
           LENGTH(RE)=4 AND SUBSTR(RE,1,2)=T;
    cursor child_cur1(t1 varchar2) is SELECT RE,NAME FROM MANUE WHERE
           LENGTH(RE)=6 AND SUBSTR(RE,1,4)=t1;
    BEGIN
 --Find the tree itself.htree := Find_Item('tmp.tree4');
        for dummy in prime_cur loop 
           	new_node := Ftree.Add_Tree_Node(htree,
              	ftree.root_node,Ftree.PARENT_OFFSET,
	              Ftree.LAST_CHILD,Ftree.EXPANDED_NODE,
	              dummy.name,'f:\ICONS\a',dummy.RE);
       	for child in child_cur(dummy.RE) loop 
                     child_node := Ftree.Add_Tree_Node
		              (htree,new_node,Ftree.PARENT_OFFSET,Ftree.LAST_CHILD,
            		 Ftree.EXPANDED_NODE,child.name,'f:\ICONS\GO',child.RE);
		        for  child1 in child_cur1(child.RE) loop
          	  	 child_node1 :=  Ftree.Add_Tree_Node(htree,
          	  	 CHILD_NODE,Ftree.PARENT_OFFSET,Ftree.LAST_CHILD,
          	  	 Ftree.EXPANDED_NODE,c hild1.name,'f:\ICONS\GO',child1.RE);
	end loop;
               end loop;
                  	end loop;
          END;


Thanks & best regards
  • Attachment: error.PNG
    (Size: 65.92KB, Downloaded 65 times)

[Updated on: Tue, 14 February 2012 14:22]

Report message to a moderator

Re: what's wrong with this code? [message #543445 is a reply to message #543388] Tue, 14 February 2012 15:03 Go to previous messageGo to next message
cookiemonster
Messages: 11207
Registered: September 2008
Location: Rainy Manchester
Senior Member
cookiemonster wrote on Tue, 14 February 2012 15:17
use messages to determine which exact line is causing the error.

Re: what's wrong with this code? [message #543476 is a reply to message #543445] Wed, 15 February 2012 00:10 Go to previous messageGo to next message
Littlefoot
Messages: 19823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You call that code FORMATTED? Not even close! Enclosing it into the [code] tags is not enough.

This is formatted - do so when posting your next messages.
DECLARE
   htree         ITEM;
   top_node      FTREE.NODE;
   new_node      FTREE.NODE;
   child_node    FTREE.NODE;
   child_node1   FTREE.NODE;
   item_value    VARCHAR2 (30);

   CURSOR prime_cur
   IS
      SELECT RE, NAME
        FROM MANUE
       WHERE LENGTH (RE) = 2;

   CURSOR child_cur (T VARCHAR2)
   IS
      SELECT RE, NAME
        FROM MANUE
       WHERE LENGTH (RE) = 4 AND SUBSTR (RE, 1, 2) = T;

   CURSOR child_cur1 (t1 VARCHAR2)
   IS
      SELECT RE, NAME
        FROM MANUE
       WHERE LENGTH (RE) = 6 AND SUBSTR (RE, 1, 4) = t1;
BEGIN
   --Find the tree itself.htree := Find_Item('tmp.tree4');
   FOR dummy IN prime_cur
   LOOP
      new_node :=
         Ftree.ADD_TREE_NODE (htree,
                              ftree.root_node,
                              Ftree.PARENT_OFFSET,
                              Ftree.LAST_CHILD,
                              Ftree.EXPANDED_NODE,
                              dummy.name,
                              'f:\ICONS\a',
                              dummy.RE);

      FOR child IN child_cur (dummy.RE)
      LOOP
         child_node :=
            Ftree.ADD_TREE_NODE (htree,
                                 new_node,
                                 Ftree.PARENT_OFFSET,
                                 Ftree.LAST_CHILD,
                                 Ftree.EXPANDED_NODE,
                                 child.name,
                                 'f:\ICONS\GO',
                                 child.RE);

         FOR child1 IN child_cur1 (child.RE)
         LOOP
            child_node1 :=
               Ftree.ADD_TREE_NODE (htree,
                                    CHILD_NODE,
                                    Ftree.PARENT_OFFSET,
                                    Ftree.LAST_CHILD,
                                    Ftree.EXPANDED_NODE,
                                    child1.name,
                                    'f:\ICONS\GO',
                                    child1.RE);
         END LOOP;
      END LOOP;
   END LOOP;
END;


Did you check items name spelling?
Re: what's wrong with this code? [message #543609 is a reply to message #543476] Wed, 15 February 2012 13:59 Go to previous messageGo to next message
mughals_king
Messages: 390
Registered: January 2012
Location: pakistan
Senior Member
Thanks for reply sir yes i have checked items name spelling but same problem sir can u point out where is the problem i shall be thanksful to u



best regards
Re: what's wrong with this code? [message #543610 is a reply to message #543609] Wed, 15 February 2012 14:07 Go to previous messageGo to next message
ThomasG
Messages: 3114
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
cookiemonster wrote on Tue, 14 February 2012 22:03
cookiemonster wrote on Tue, 14 February 2012 15:17
use messages to determine which exact line is causing the error.


Re: what's wrong with this code? [message #543614 is a reply to message #543610] Wed, 15 February 2012 15:14 Go to previous messageGo to next message
mughals_king
Messages: 390
Registered: January 2012
Location: pakistan
Senior Member
Sir i checked already line to line but doesn't show any error i couldn't find anything pls help and point out where is the problem its little urgent sir if u can do it fast i would be grateful to u



thanks
Re: what's wrong with this code? [message #543615 is a reply to message #543614] Wed, 15 February 2012 16:50 Go to previous messageGo to next message
ThomasG
Messages: 3114
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
We have no chance of finding anything, since we don't even know in which line the error is happening. You have to do basic debugging first.
Re: what's wrong with this code? [message #543883 is a reply to message #543615] Fri, 17 February 2012 06:20 Go to previous messageGo to next message
mughals_king
Messages: 390
Registered: January 2012
Location: pakistan
Senior Member
        create table manue(re varchar2(9),
                     name varchar2(25),
                     manue_name varchar2(25));


       insert into manue
                   values('01','Main',null);
       insert into manue
                   values('02','Forms',null);
       insert into manue
                   values('0101','Design','DESIGNS');
       insert into manue
                   values('0102','m_products','PRODUCTS');
       insert into manue
                   values('0103','Sizes','SIZES');
       insert into manue
                   values('03','Reports',null);
       insert into manue
                   values('0301','Lpo','Report');
       insert into manue
                   values('0302','Purchase Report',null);
       insert into manue
                   values('0303','Sales Report',null);
/
commit;



i have uploaded fmb file try to run with u might be u will find something this time and also requesting to all seniors pls download this fmb file and point out where i'm wrong OR tell me simply how to run only reports .rep file through tree menu. i hope this time i shall get some answer from experts for the new commers in this forum.


thanks in advance



  • Attachment: TREE_EXP.fmb
    (Size: 56.00KB, Downloaded 56 times)

[Updated on: Fri, 17 February 2012 06:50]

Report message to a moderator

Re: what's wrong with this code? [message #543894 is a reply to message #543610] Fri, 17 February 2012 06:55 Go to previous messageGo to next message
cookiemonster
Messages: 11207
Registered: September 2008
Location: Rainy Manchester
Senior Member
ThomasG wrote on Wed, 15 February 2012 20:07
cookiemonster wrote on Tue, 14 February 2012 22:03
cookiemonster wrote on Tue, 14 February 2012 15:17
use messages to determine which exact line is causing the error.




If you don't understand what that means say so.

You need to put pairs of the message builtin between each line of existing code so you can at what point the error occurs. ie:
BEGIN
   message(1); 
   message(1);
   --Find the tree itself.htree := Find_Item('tmp.tree4');
   FOR dummy IN prime_cur
   LOOP
     message(2);
     message(2);
      new_node :=
         Ftree.ADD_TREE_NODE (htree,
                              ftree.root_node,
                              Ftree.PARENT_OFFSET,
                              Ftree.LAST_CHILD,
                              Ftree.EXPANDED_NODE,
                              dummy.name,
                              'f:\ICONS\a',
                              dummy.RE);
message(3);
message(3);
      FOR child IN child_cur (dummy.RE)
      LOOP
message(4);
message(4);
.....
.....

Do that and tell us which line is causing the error. We will not help you until you do.
Re: what's wrong with this code? [message #543925 is a reply to message #543894] Fri, 17 February 2012 12:35 Go to previous messageGo to next message
mughals_king
Messages: 390
Registered: January 2012
Location: pakistan
Senior Member
i think i found the problem in which line i think


DECLARE
   htree         ITEM;
   top_node      FTREE.NODE;
   new_node      FTREE.NODE;
   child_node    FTREE.NODE;
   child_node1   FTREE.NODE;
   item_value    VARCHAR2 (30);

   CURSOR prime_cur
   IS
      SELECT RE, NAME
        FROM MANUE
       WHERE LENGTH (RE) = 2;

   CURSOR child_cur (T VARCHAR2)
   IS
      SELECT RE, NAME
        FROM MANUE
       WHERE LENGTH (RE) = 4 AND SUBSTR (RE, 1, 2) = T;

   CURSOR child_cur1 (t1 VARCHAR2)
   IS
      SELECT RE, NAME
        FROM MANUE
       WHERE LENGTH (RE) = 6 AND SUBSTR (RE, 1, 4) = t1;
BEGIN
   --Find the tree itself.htree := Find_Item('tmp.tree4');
   FOR dummy IN prime_cur
   LOOP
-----------------I think here is the problem null value
     message(new_node);                             
     message(new_node);                             
     
         new_node :=
         Ftree.ADD_TREE_NODE (htree,
                              ftree.root_node,
                              Ftree.PARENT_OFFSET,
                              Ftree.LAST_CHILD,
                              Ftree.EXPANDED_NODE,
                              dummy.name,
                              'f:\ICONS\a',
                              dummy.RE);
message(dummy.re);
message(dummy.re);
message(dummy.name);---value comming 1.Menu 2.Forms 3.Reports
message(dummy.name);

--value is comming null am i right sir now solution please
-----------------------------------------------------    
      FOR child IN child_cur (dummy.RE)
      LOOP
         child_node :=
            Ftree.ADD_TREE_NODE (htree,
                                 new_node,
                                 Ftree.PARENT_OFFSET,
                                 Ftree.LAST_CHILD,
                                 Ftree.EXPANDED_NODE,
                                 child.name,
                                 'f:\ICONS\GO',
                                 child.RE);

         FOR child1 IN child_cur1 (child.RE)
         LOOP
 message(child.re);
 message(child.re);
 message(child_node1);
 message(child_node1);
               child_node1 :=
               Ftree.ADD_TREE_NODE (htree,
                                    CHILD_NODE,
                                    Ftree.PARENT_OFFSET,
                                    Ftree.LAST_CHILD,
                                    Ftree.EXPANDED_NODE,
                                    child1.name,
                                    'f:\ICONS\GO',
                                    child1.RE);
         END LOOP;
      END LOOP;
   END LOOP;
END;


if i'm right thn pls solution

thanks

[Updated on: Fri, 17 February 2012 12:54]

Report message to a moderator

Re: what's wrong with this code? [message #543928 is a reply to message #543925] Fri, 17 February 2012 13:22 Go to previous messageGo to next message
cookiemonster
Messages: 11207
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you think null is a problem change your code to avoid null values.
Since you haven't made it clear which value is null I can't say more than that.
Re: what's wrong with this code? [message #543930 is a reply to message #543928] Fri, 17 February 2012 13:28 Go to previous messageGo to next message
mughals_king
Messages: 390
Registered: January 2012
Location: pakistan
Senior Member
thanks sir i have solved my problem

problem was here

htree := Find_Item('tmp.tree4');


thanks for helping me a lot




Re: what's wrong with this code? [message #543931 is a reply to message #543930] Fri, 17 February 2012 13:38 Go to previous message
mughals_king
Messages: 390
Registered: January 2012
Location: pakistan
Senior Member
sometime due to heavy work of load its happening the problem was very minor but i was confusing anwayz thanks for giving me a clues and not telling the exact problem & allowed me to do my self.



Thanks & best regard

Previous Topic: PUSH BUTTON TRIGGER CODE ERROR(5 Merged)
Next Topic: Open .CSV file using Web.show_document on 11gAS
Goto Forum:
  


Current Time: Fri Nov 28 09:04:32 CST 2014

Total time taken to generate the page: 0.10512 seconds