الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

عاوزة اعمل بحث عب بيانات فالشجرة

Featured Replies

بتاريخ:

السلام عليكم ورحمة الله وبركاته
اخوتي فالله
انا باعمل مشروع تخرج علي 10g
ومطلوب مني اعمل شجرة بالموظفين المديرين والموظفين ودي كويسة بس انا عاوزة اعمل بحث داخل الشجرة
اكتب مثلا اول حرف من اسم الموظف يقوم يعلم علي الموظف ده ولو اكتر من موظف براسطة up and down
اقدر اتنقل بين الموظفين
ياريت حد يساعدني لاني مش لاقية حل خالص
شكرا

بتاريخ:

Subject: How To Search A Subtree And Any Branches It May Have



PURPOSE ------- The purpose of this note is to show developers on how to search a tree and all any branches it might have. SCOPE & APPLICATION ------------------- This article is written for developers with knowleadge of Hierarchical Trees within Oracle Forms Developer. It has taken the assumption that a form with a Tree based on the demo table EMP has been created. If this is not the case, please refer to NOTE:1071059.6 How to Create a Hierarchical Tree with Forms 6.0 Although this is based on Forms version 6, it still holds true for versions 6i & 9i. It is strongly recommended that you implement the EMP hierachical tree as this article will reference the structure on several occasions. How To Search A Subtree And Any Branches It May Have ---------------------------------------------------- On several occasions it has been asked on how can we search a tree and all it's branches. For example, taking the EMP tree as an example, you want to start at 'JONES' and search for all nodes under 'JONES'. In this case, 'SCOTT', 'ADAMS', 'FORD' and 'SMITH'. You can loop through all the nodes under 'JONES' but this gives a problem when it comes to a subtree that you are not interested in. That is it will still continue to loop outside the subtree that you are interested in. NOTE:77645.1 gives you an example of how to loop through a tree, although this is note is for expanding/collopsing a tree, there is code to show how to loop through ALL of a tree. However, there is the built-in FTREE.FIND_TREE_NODE which takes in a parameter of FIND_NEXT_CHILD. Unfortuately this gives us another problem. Using 'JONES' as our starting point, and issuing FTREE.FIND_TREE_NODE with FIND_NEXT_CHILD finds 'BLAKE', she sibling and not the child of 'JONES'. 'SCOTT' is one of the childrens of 'SCOTT'. So where does that leave us ? Well we have seen from above that the FTREE package is not good enougth to obtain our goal. However, with a bit of PL/SQL we can achieve our goal. The two solutions I found was to use 1. Recursive Procedure 2. Itteration. Both are discussed below. 1. Recursive Procedure. ----------------------- In this approch what we do is seach all nodes in the subtree. If a node in the subtree is found to be a subtree (branch) itself, we call the procedure again passing that branch node as the starting point. Thus, the procedure will call itself recursively when a branch is found. An example of this code is shown below. If your are having difficulty in understanding the code, it is easier if you have a picture of the tree to make things easier. It is for this reason (and others) why the EMP tree needs to be implemented as mentioned above. ---- Start of Procedure ---- PROCEDURE Proc_Loop (p_htree ITEM, p_SubTree FTREE.NODE) IS v_label VARCHAR2(100); v_NODE FTREE.NODE; BEGIN -- Display the current node label. v_label := FTREE.Get_TREE_NODE_PROPERTY(p_htree, p_subtree, FTREE.NODE_LABEL); message (v_label);pause; -- Find the next node under the subtree/branch that has been passed into the -- proc v_NODE := FTREE.FIND_TREE_NODE (p_htree, '', FTREE.FIND_NEXT_CHILD, FTREE.NODE_LABEL, p_subtree, p_subtree); WHILE NOT FTREE.ID_NULL(v_NODE) LOOP -- Loop in the subtree/branch IF FTREE.Get_TREE_NODE_PROPERTY (p_htree, v_NODE, FTREE.NODE_STATE) != FTREE.LEAF_NODE THEN -- The current node is a Subtree itself. Lets Loop in that child subtree. Proc_Loop (p_htree, v_NODE); ELSE -- Get the label of the tree and messge it out to the screen. v_label := FTREE.Get_TREE_NODE_PROPERTY (p_htree, v_NODE, FTREE.NODE_LABEL); message (v_label);pause; END IF; -- Move onto the next node in the subtree v_NODE := FTREE.FIND_TREE_NODE (p_htree, '', FTREE.FIND_NEXT_CHILD, FTREE.NODE_LABEL, '', v_NODE); END LOOP; END; ---- End of Procedure ---- Now that we have the procedure, how do we test this. In the following example we test this by having a button with a WHEN-BUTTON-PRESSED trigger with the following code. ---- Start of WHEN-BUTTON-PRESSED ---- DECLARE htree ITEM; /* Tree item in forms */ subtree_node FTREE.NODE; /* Starting point of Subtree/Branch in question we want to search */ v_node FTREE.NODE; /* Current node within the Subtree/Branch */ BEGIN -- Find the tree. htree := FIND_ITEM ('TREE_BLOCK.TREE_ITEM'); -- Find the START of the subtree we need to search from. -- In this case the start point will be the node_label with 'JONES' subtree_node := FTREE.Find_Tree_Node (htree, 'JONES', FTREE.FIND_NEXT, FTREE.NODE_LABEL, FTREE.ROOT_NODE, FTREE.ROOT_NODE); -- Now that we have the starting point, lets loop through it by calling -- the procedure Proc_Loop passing in the starting node. Proc_LOOP (htree, subtree_node); END; ---- End of WHEN-BUTTON-PRESSED ---- 2. Itteration. -------------- In this solution we start of with find at what level the starting point is. Using the EMP tree and 'JONES'as an example, we can find out that 'JONES' is at level 2. The next stage is to go through each and every following nodes after 'JONES' and checking to see that the node we are currently on is always greater than the level 'JONES' is at. If we reach a node that is at the same level as 'JONES' we know that we have seached all the nodes under 'JONES' and are now out of the scope of the subtree we are interested in. The example code, is taken from a WHEN-BUTTON-PRESSED trigger ---- Start of WHEN-BUTTON-PRESSED ---- DECLARE htree ITEM; subtree_node FTREE.NODE; v_node FTREE.NODE; v_NodeDepth_Start NUMBER; v_NodeDepth_Current NUMBER; v_NodeLabel VarChar2(20); BEGIN -- Find the tree. htree := FIND_ITEM ('TREE_BLOCK.TREE_ITEM'); -- Find the START of the subtree we need to search from. -- In this case the start point will be the node_label with 'JONES' subtree_node := FTREE.Find_Tree_Node (htree, 'JONES', FTREE.FIND_NEXT, FTREE.NODE_LABEL, FTREE.ROOT_NODE, FTREE.ROOT_NODE); -- Find the depth of the starting Node (eg, 'JONES') v_NodeDepth_Start := FTREE.Get_Tree_Node_Property (htree, subtree_node, FTREE.NODE_DEPTH); v_NodeLabel := FTREE.Get_Tree_Node_Property (htree, subtree_node, FTREE.NODE_LABEL); -- Before we start going into the loop to search v_NODE := FTREE.FIND_TREE_NODE (htree, '', FTREE.FIND_NEXT, FTREE.NODE_LABEL, '', subtree_node); v_NodeDepth_Current := FTREE.Get_Tree_Node_Property (htree, v_node, FTREE.NODE_DEPTH); v_NodeLabel := FTREE.Get_Tree_Node_Property (htree, v_NODE, FTREE.NODE_LABEL); WHILE v_NodeDepth_Start < v_NodeDepth_Current LOOP MESSAGE (v_NodeLabel || ' ' || v_NodeDepth_Current);pause; v_NODE := FTREE.FIND_TREE_NODE (htree, '', FTREE.FIND_NEXT, FTREE.NODE_LABEL, '', v_node); v_NodeDepth_Current := FTREE.Get_Tree_Node_Property (htree, v_node, FTREE.NODE_DEPTH); v_NodeLabel := FTREE.Get_Tree_Node_Property (htree, v_NODE, FTREE.NODE_LABEL); END LOOP; END; ---- End of WHEN-BUTTON-PRESSED ----

اليك هذه الطلاسم ولكنها مفيدة جداً لا امتلك الوقت حتى اقراها مشكلتك عويصة ولكنك انت المستفيد الاول والاخير
والى الامام جميعاً

بتاريخ:
  • كاتب الموضوع

اخي مصطفي
انا اتعقدت ما كنتش فاكرة الموضوع صعب كده
اخوتي انا عاوزة الحل لو حد عنده خبره بالtree
شكرا اخي مصطفي لو ممكن مثال اكون مشكورة

بتاريخ:

هذا الذي عندي ولا احب التقاعس
اعانك الله

والى الامام جميعاً

  • بعد 3 أسابيع...
بتاريخ:

شو هاااااااااااااااااااااااااااااااااااااد

بتاريخ:

بعيد الشر عنك كود بالهبل بس احنا الهبل نفهمه ونستخدمه

بتاريخ:

يا ريت شرح مبسط
لل
tree

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.