Tree Issue--Data out of order?

All,
I suspect this is more of a generic SQL question, but, anyhow, I'm trying to create a tree report of the items in our bills of materials. When I run the page, the tree is empty (not even a root). Trying to figure out what the problem is, I've copied the SQL into Toad and run it; the results seem to be scrambled, which I suspect is why the tree is failing. Here's the query:
select case when connect_by_isleaf = 1 then 0
            when level = 1             then 1
            else                           -1
       end as status,
       level,
       comp_item_number as title,
       null as icon,
       comp_inventory_item_id as value,
       null as tooltip,
       null as link
from apex.bom_tree_v
where organization_id = 126
start with comp_item_number = 'C70-1039'
connect by prior comp_inventory_item_id = parent_item_id
order siblings by comp_item_numberThe query returns 64 rows for my test item, which is correct, but the top-level item (level = 1) is returned as the 10th row (consistently), rather than the first. All of the documentation I've been able to find indicates that the rows should be returned in hierarchical order.
Anyone have any idea what I'm missing?
-David

Good afternoon David,
Trees in APEX are not even closely populated the same as in Forms. What I did was this:
<li>Query the top of your tree...
<li>Do a UNION ALL SELECT for the next level of your tree
<li> and repeat the UNION ALL SELECT for each indented level of your tree.
Mine looks something like this:
select 'A' id,
        null as pid,
        'Table Of Contents' name,
        NULL link,
        'f?p=&APP_ID.:1:&APP_SESSION.:CONTRACT,A' A1,
        'f?p=&APP_ID.:1:&APP_SESSION.:EXPAND,A' A2
   from dual
  union all
select ltrim(rtrim(to_char(toc_seq_id))) id,
        'A' pid,
        toc_description name,
        'f?p=&APP_ID.:1:&APP_SESSION.:::RP:TOCP:' || toc_seq_id link,
        'f?p=&APP_ID.:1:&APP_SESSION.:CONTRACT,' || TO_CHAR(toc_seq_id) ||'::RP:TOCP:' || TO_CHAR(toc_seq_id) A1,
        'f?p=&APP_ID.:1:&APP_SESSION.:EXPAND,' || TO_CHAR(toc_seq_id) ||'::RP:TOCP:' || TO_CHAR(toc_seq_id) A2
   from my_toc
  where state_id = :P1_STATE
    and toc_level = 1
    and (toc_seq_id < 9
      or  (toc_seq_id < 10 and :P1_User_Type = 2)
      or  (toc_seq_id < 10 and :P1_CUSTOM_USER = 'Y')
      or  (toc_seq_id < 15 and :P1_User_Type > 2 and :P1_CUSTOM_USER != 'Y'))
union all
select ltrim(rtrim(toc_seq_id)) id,
        ltrim(rtrim(toc_parent)) pid,
        toc_description name,
        'f?p=&APP_ID.:' || ltrim(rtrim(to_char((toc_parent+2)))) || ':&APP_SESSION.:::RP:P1_ENTRY_ID:' || toc_entry_id link,
        null a1,
        null a2
   from my_toc
  where state_id = :P1_STATE
    and toc_level = 2
    and (toc_parent < 9
      or (toc_parent = 9 and :P1_User_Type = 2)
      or  (toc_seq_id < 10 and :P1_CUSTOM_USER = 'Y')
      or  (toc_seq_id < 15 and :P1_User_Type > 2 and :P1_CUSTOM_USER != 'Y'))
order by 3,1The code that looks like this:
'f?p=&APP_ID.:' || ltrim(rtrim(to_char((toc_parent+2)))) || ':&APP_SESSION.:::RP:P1_ENTRY_ID:' || toc_entry_id link,is building a link to a page based on the value of the entry (:P1_ENTRY_ID) so the user can click on an entry and jump to that item.
My tree looks like this: (I can't paste an image, so I'll wing it with text - notice my tree started out with
entry zero [0] because I had to add it after the tree was built)
- Table of Contents
  + 0. First branch of my tree
  + 1. Second branch of my tree
  -  2. Third branch - expanded
     +  Entry 1 for third level
     +  Entry 2 for third level
  + 3. Fourth branch of my tree
  + 4. Fifth branch of my treeIt took me awhile to figure all of this out, but once I did, it began to make sense.
The whole idea is that each SELECT will select the next indented level in the tree. Then in the end, use ORDER BY 3,1 to order your tree properly by the parent and then the child within the parent.
I hope this makes sense and that it helps.
Good luck,
Don.
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone! :)

Similar Messages

  • Calculation of goods issue date in sales order with routes

    Hello Gurus,
    This is my first post on SCN, I'm excited to share a new little problem I have.
    I have configured my routes determination as per our requirements.  For example, I have one route configured in 0VTC such that the transit duration is 1 hour.
    When I create a sales order, I enter that route (1 hour transit.dur) under shipping on the line item.  Then I set a delivery date sometime in the future to test out my config.  Looking at the shipping "Goods Issue Date", I see that the date is 2 hours earlier than my delivery date.  It's supposed to be 1 hour.
    I looked through many forums and found no help on this.  My factory calendar is configured such that all days, including weekends and holidays are production days.
    Please advise at your earliest.
    Thanks,
    Mido

    Hi TW Typewriter,
    Yes, I am changing the date in the "schedule lines" tab for the sales order to a date next week, say May 23, 2014.  When I click on the display "Shipping" info, I see:
    1) Delivery date: 05/23/2014 - 00:00
    2) GI Date: 05/22/2014 - 22:00:00
    The expectation is to have the GI date 23:00:00 since my config for the route on the sales order is for 1 hr of transit time only.
    See attached

  • How to fetch post goods issue date and sales order creation date

    Hi All,
    How to find out the difference between SD Sales Order Item Creation Date and final Post goods issue Date. I would like to know how to fetch those dates and what is the relationship between the tables from which i will get the dates.
    Please let me know the solution .
    Thanks in advance.

    Hi,
    Sales order creation date is when u raise a sales order in favor of the customer using VA01.......using ATP logic system purposes the material availability date....
    after saving ur sales order...when u raise the Delivery using VL01n  w.r.t to OR...than u have to perform picking ....In the picking Tab...specify the amount to be picked than press Post Good Issue....means the goods left the company premises ..
    You can the fetch the values using tables-  Use T code   SE12  or SE16
    Vbak-----order header
    Vbap-----order item
    Vbek-----order schedule line
    Likp-----Delivery header
    Lips----Delivery item

  • Mavericks, Photo Booth issues -- photos out of order

    I recently updated to Mavericks, and since then all of my photos have been out of order in Photo Booth. I have been able to reorganise them according to date created in the root folder, but not in Photo Booth itself.
    Any ideas?

    Same issue here as well. Photobooth is sorting by file name. New images created have a long file name includng the date and time. Earlier photos are named photo1.jpg...Anybody know a good file re-namer?

  • Gmail dates out of order

    I recented moved from an exchange server to Gmail utilizing IMAP. The problem is that my emails are not in date order on my iphone 5s 7.1 (problem still existed under 7.0.6), but they appear perfectly in Gmail via web, Outlook, and Apple Mail. I can't seem to figure out what order they are actually in. I have exposed the date fields in outlook like date create, modified, received, sent, etc, but even ordering on any of those doesn't explain the sort order on the iPhone.
    Thanks for any input!

    Hello Omar12345
    Have you tried removing your email account and then add it back in to Mail. Also have you tried using the Gmail app to see if it works there?
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    Gmail - email from Google
    https://itunes.apple.com/us/app/gmail-email-from-google/id422689480?mt=8
    Regards,
    -Norm G.

  • Chart date out fo order

    Upgraded 10g to 11g. Most graphs are displaying correctly however have 1 chart that the dates are out fo order, though there is a sort on the calendar ID. I have a field called calendar ID with data such as 201101 = 2011 Jan and 201102 = 2011 Feb. If I view this in table view it shows correctly, but as a chart starts at like Jun 2001 then Aug 2011, etc. Is this a know bug or a easy fix?

    Post Author: qcheng
    CA Forum: Charts and Graphs
    Right click the chart > select "Chart Expert" > "Data" Tab > Select the "On Change Of" field > Click "Order" button > select "in original order". Your group will be in right order now.

  • Line Chart in Infoview Dates out of order

    Hi,
    I have a report that works fine on the desktop but when it is run from within Infoview, the date range in the X axis of the line chart are no longer in order.
    Any ideas how I can correct this?
    Thanks,
    John

    Hi John,
    What are the versions  (along with any fix packs if any) of the following:
    1) Crystal Reports designer
    2) BusinessObjects Enterprise
    Also, could you try changing the Viewer Type for Crystal Reports? If it is set to Web (No downloading), try changing that to ActiveX.
    - Abhilash
    Follow us on Twitter
    Got Enhancement ideas? Try the SAP Idea Place
    Share Your Knowledge in SCN Topic Spaces

  • Chart date out of order

    Post Author: [email protected]
    CA Forum: Charts and Graphs
    I have a chart that is grouped on the date by month.  The data in the main crosstab report is in the correct order but the dates are grouped incorrectly in the graph.  The graph is listing in this order:
    1/2007, 10/2007,11/2007, 2/2007,3/2007....
    It's picking up the first number as the sort order instead of the date.  I've checked by date format and everything is correct in my report.  What can I change to get the chart date order correct?

    Post Author: qcheng
    CA Forum: Charts and Graphs
    Right click the chart > select "Chart Expert" > "Data" Tab > Select the "On Change Of" field > Click "Order" button > select "in original order". Your group will be in right order now.

  • Can Numbers put the dates (in a column) in order if I enter out of order

    I am a procrastinator and I have lots of receipts to enter.  If I enter with the dates out of order is there a way numbers can put in order for me.
    Thank you

    Robin,
    When you hover your mouse over the column Label area of an active Table, a disclosure triangle appears. Clicking the triangle gives you a menu of column actions, including Sorting the column, either ascending or descending.
    Sorting will put your dates in order. The prerequisite is that the dates you enter must be recognized as Date/Time values, not as Text. If you input your dates in a standard way for you region/language, they will normally be properly recognized. One way to test for this is to Select the Dates column and change the date format in the Cell Inspector. If you can freely change the format, for example from "1/1/15" to "January 1, 2015", the sort will be successful.
    Regards,
    Jerry

  • Catalog B-Tree: "Keys Out of Order"

    One day my ibook G4 suddenly stopped working. It started up, but there was only a blue screen. The cursor worked, but the desktop, dock, everything else was gone--nothing to click on.
    I went to Apple support and discussions and followed info given there:
    I ran the Hardware Test disk: It said everything passed. After that the apple and start-up window appeared, but it stopped, usually after "Starting Network..." came on, then it would become an all blue screen once again...and the cursor was frozen in the upper left hand corner.
    I reset the PMU and tried to run the software restore disk, (shutdown and restarted holding "C" down). This time the start up got as far as "...time synchronization..." then stopped and went to blue screen again. (The disc icon didn't come up on screen, nor did it just start working as the Hardware Test disc did.)
    After more research in the discussion groups, I started up in single entry mode and ran an "fsuk" check. It gave the "Catalog B-Tree: keys out of order" and Macintosh HD cannot be repaired message.
    Then I read that if you have an "Extended" journal (or ?) the fsck might give benign error messages. So I don't know if the Catalog B problem is correct or not.
    Further research led me to "Computer stops responding at "starting Network Filesystem" which is exactly where it stopped before I reset the PMU (which I understand resets the clocks).It suggests there is an NFS export Loopback problem and says to restore my network.nidb file from a good backup (what would that be?) or delete or modify the mount(s) causing the issue (also clueless as to what that might be).
    I am hesitant to do anything else. (One bit of info said that if there is a file directory issue such as Catalog B, running and Upgrade or Archive and Install might worsen the problem.)
    Can anyone here let me know what I should do, or if this is a fixable problem?
    Thanks!

    What Format is the Disk?
    If it's HFS+ hen DiskWarrior® stands a good chance of fixing it, much better than fsck anyway.
    Don't trust the Apple HW CD... it's next to worthless for finding problems last time I used it.
    You can also pull ALL yhe Batteries and AX, let it set overnite, to reset everything.
    If the HD is really shot, then you'll need an external HD and one of these...
    http://subrosasoft.com/OSXSoftware/index.php?mainpage=product_info&productsid=1
    http://www.prosofteng.com/products/datarescueinfo.php

  • Data written to socket getting lost?  or perhaps out of order?

    I'm trying to fix a bug in Flashmog. The bug is described in more detail here.
    Basically what is happening is that my Flash client claims that it is calling functions that don't arrive at the server -- or they arrive, but the socket data is out of order and therefore is garbled.  I've stared at the source code for hours and tried a lot of trial-and-error type stuff and added trace statements to see if I can find the problem and I'm not having any luck.
    In particular, there's class I have called RPCSocket that extends the AS3 Socket class so I can serialize data structures before sending them across a socket.  At one point, this RPCSocket class calls super.writeBytes and super.Flush.  It is the point at which I send all data out of my client. The data is binary data in AMF3 format.
              public function executeRPC(serviceName:String, methodName:String, methodParams:Array):void {
                   if (!this.connected) {
                        log.write('RPCSocket.executeRPC failed. ' + methodName + ' attempted on service ' + serviceName + ' while not connected', Log.HIGH);
                        throw new Error('RPCSocket.executeRPC failed. ' + methodName + ' attempted on service ' + serviceName + ' while not connected.');
                        return;
                   var rpc:Array = new Array();
                   rpc[0] = serviceName;
                   rpc[1] = methodName;
                   rpc[2] = methodParams;
                   var serializedRPC:ByteArray = serialize(rpc);
                   if (!serializedRPC) {
                        log.write('RPCSocket.executeRPC failed.  Serialization failed for method ' + methodName + ' on service ' + serviceName, Log.HIGH);
                        dispatchEvent(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, 'RPCSocket.executeRPC failed.  Serialization failed for method ' + methodName + ' on service ' + serviceName));
                   super.writeUnsignedInt(serializedRPC.length);
                   super.writeBytes(serializedRPC);
                   super.flush();
              } // executeRPC
    Can someone recommend a way for me to store without corruption, conversion, or filtering or translation of any kind *all* of the information sent across this socket? I'd like to write it to a file.  I'm guessing that keep a global ByteArray var and storing the info there might work, but I'm wondering how I might get the contents of that ByteArray into a file so I can inspect it.
    Also, I'm wondering if I might be able to inspect what flash actually sends out on the socket?  I have a sneaking suspicion that data I supply to super.writeBytes may be sent out of order or may not actually get sent across the socket.  This bug I'm talking about only seems to happen under high-stress situations when I'm sending dozens of messages per second across this one socket.

    oops...forgot link to bug description: http://flashmog.net/community/viewtopic.php?f=5&t=549

  • Billing date(fkdat) in sales order item is not copied from Goods Issue Date

    Hi All
    we are facing problem at item level billing date field.This field should be filled with the GI Date in schedule lines shipping tab.
    but, it(billing date) is not being filled with goods issue date but, with the required deliver date at sales order header.
    Please give me a solution and the root cause. This is urgent as business is halted.
    Thanks
    Kumar

    Lakshmipati
    This is from SAP Screen
    "If invoice dates are defined for the customer, the system proposes the billing date from the invoice date calendar. If no invoice dates are agreed, then the actual goods issue date is formed on the basis of delivery related billing. In order related billing, the billing date of the order forms the basis of the billing date."
    earlier it is happening as desired.i.e., billing date=GI Date.
    but, as of now it is taken from the required delivery date.
    Please give me solution
    Kumar

  • After syncing Pc-Ipad my Photo's are out of order. In the folders they don't follow the Date-order. I use Itunes 10.6.1.7 and Ipad 5.1. The Problem is the same with XP and Windows 7.

    After syncing PC-Ipad my Photo's on Ipad2 are out of order. In the Folders/Albums the Photo's are no longer in the order of (EXIF) dates. I have updated Itunes to 10.6.1.7 and IPad2 to 5.1. I have reset the IPad2. I cleaned the Photo-cache and removed Itunes and Installed again. I tried it with Windows 7 (64) and XP, makes no difference. I tried it with one Album, Photo's also out of order. It doesn't seem to happen with my Ipad1 older software version. I there a bug in the newest software? Thanks for Help!
    Rudy from the Netherlands.

    problem solved after updating itunes to 10.6.3

  • Goods issue dates are different in sales order & delivery

    Hi,
    We have a situation where in sales order schedule line tab goods issue date is 21.30.2011
    but in delivery the planned GI date is 28.03.2011.
    There are two line item in the sales order & in both the line items all the dates are same.
    Same route is there in sales order & delivery.
    In delivery Item category avalability check Off is Y(Do not check avail. when reporting results of pick.request)
    All the dates(delivery,loading,Transportation planning) are different .
    waiting for responce.
    Thanks In advence
    Susrikant

    goods issue date is 21.30.2011
    What was the Actual GI date in delivery??  This should be the same as schedule line date.
    thanks
    G. Lakshmipathi

  • Regarding Goods issue date and order date.

    Hi All,
    Could you please tell me from where we can fetch Goods issue date and Order date.
    Waiting for your reply.

    Preeti,
    Goods issue date/order date of what ?
    Goods can be issued in a number of ways, in reference to many types of documents.  In each case, the GI date and order date are found in different places.
    Please elaborate your request.
    Best Regards,
    DB49

Maybe you are looking for

  • "Disk error" message on install

    I have a CD for Windows XP Pro. I ran the BootCamp partition and the first part went smoothly. After I restarted to finish the install, I got this message in a DOS formatted screen... Disk error Press any key to restart When I press a key, nothing ha

  • Ipod nano not showing up in ITunes 9.2.1.5 on Windows XP

    My mom has a 4GB 1st generation nano and I've been trying to add new songs via iTunes. I have tried all the suggestions for "iPod appears in Windows but not iTunes" article and I still cannot get her ipod to show up in iTunes. The computer I'm trying

  • IDVD Multiple Disc Burning

    I created a movie in IMovie and put it into IDVD and went through the encoding process and it burned fine with no problems, but I wanted to burn several DVD's without closing it, but it did not give me the option of "would you like to burn another di

  • ALV Grid: method double_click provides wrong information with 'totals line'

    Hi together, I´m using 'method double_click' with an ALV grid...like: CLASS lcl_events IMPLEMENTATION.   METHOD double_click.     READ TABLE it_outtab INDEX e_row-index INTO s_datatab. Everything works perfect as long as I don´t use totals with it. U

  • Local Copy of Third Party Data

    There has been a serious proformance issue with a web application we are releasing soon. The problem is that we are displaying some third party data ( stock rates of each day) taken from some other sites. This is making the application remarkably slo