Convert Non-Hierarchical data into Hierarchical data for Tree creation

Hi guys,
I've been trying to figure this out for about two entire days now and I'm still stuck and see no possible solution which doesn't involve a new table creation.
Thing is that I want to create a Tree to navigate through Projects and Tasks, I'm using the "Task Manager" demo app, which I have customized a bit to fit my needs.
Basically I cannot create the Tree 'cause the relation between Projects and Tasks is not a hierarchical relation, it's a 1:N relation as this:
__Projects__
ID (PK)
PROJECT_NAME
___Tasks___
ID (PK)
PROJECT_ID (FK references Projects.ID)
So what I need to do is "force" that 1:N relation to a a hierarchical relation by creating a query (view) that joins the two tables into a single one and that have 2 columns I can use as ID and PARENT_ID for the tree creation.
This is the Data Model:
CREATE TABLE "EBA_TASK_PROJECTS"
(     "ID" NUMBER,
     "PROJECT_NAME" VARCHAR2(255),
     "CREATED_ON" DATE NOT NULL ENABLE,
     "CREATED_BY" VARCHAR2(255) NOT NULL ENABLE,
     "UPDATED_ON" DATE,
     "UPDATED_BY" VARCHAR2(255),
     "FLEX_01" VARCHAR2(4000),
     "FLEX_02" VARCHAR2(4000),
     "FLEX_03" VARCHAR2(4000),
     "FLEX_04" VARCHAR2(4000),
     "FLEX_05" VARCHAR2(4000),
     "PARENT_ID" NUMBER,
     "IS_ACTIVE" VARCHAR2(1),
     "DESCRIPTION" VARCHAR2(4000),
     CONSTRAINT "EBA_TASK_PROJECTS_ACTIVE_CC" CHECK (is_active in ('Y', 'N')) ENABLE,
     CONSTRAINT "EBA_TASK_PROJECTS_PK" PRIMARY KEY ("ID") ENABLE
) ;ALTER TABLE "EBA_TASK_PROJECTS" ADD CONSTRAINT "EBA_TASK_PROJECTS_FK" FOREIGN KEY ("PARENT_ID")
     REFERENCES "EBA_TASK_PROJECTS" ("ID") ON DELETE CASCADE ENABLE;
CREATE TABLE "EBA_TASK_TASKS"
(     "ID" NUMBER NOT NULL ENABLE,
     "PROJECT_ID" NUMBER NOT NULL ENABLE,
     "TASK_PRIORITY" VARCHAR2(400) NOT NULL ENABLE,
     "TASK_DIFFICULTY" VARCHAR2(400) NOT NULL ENABLE,
     "TASK_NAME" VARCHAR2(4000) NOT NULL ENABLE,
     "TASK_DETAILS" VARCHAR2(4000),
     "CREATED_ON" DATE NOT NULL ENABLE,
     "COMPLETED" DATE,
     "CREATED_BY" VARCHAR2(400) NOT NULL ENABLE,
     "STATUS" VARCHAR2(4000),
     "UPDATED_ON" DATE,
     "STARTED" DATE,
     "TASK_PREDEFINED_ID" NUMBER,
     "UPDATED_BY" VARCHAR2(255),
     "USER_NAME" VARCHAR2(255) NOT NULL ENABLE,
     "FLEX_01" VARCHAR2(4000),
     "FLEX_02" VARCHAR2(4000),
     "FLEX_03" VARCHAR2(4000),
     "FLEX_04" VARCHAR2(4000),
     "FLEX_05" VARCHAR2(4000),
     "PERCENTAGE" NUMBER,
     CONSTRAINT "EBA_TASK_TASKS_PK" PRIMARY KEY ("ID") ENABLE
) ;ALTER TABLE "EBA_TASK_TASKS" ADD CONSTRAINT "EBA_TASK_TASKS_PROJECTS_FK" FOREIGN KEY ("PROJECT_ID")
     REFERENCES "EBA_TASK_PROJECTS" ("ID") ON DELETE CASCADE ENABLE;
I'm using APEX4.0
That's pretty much it guys, hope you can help me with this. I'm really stuck on this and am about to give up.

WOW Odie! You're awesome !! It worked like a charm, I created a view as you suggested:
CREATE OR REPLACE FORCE VIEW "VIEW_TASKS_PROJECTS_TREE" ("ID", "PARENT_ID", "NODE_NAME") AS
SELECT to_char(id) as id
, null as parent_id
, project_name as node_name
FROM eba_task_projects
UNION ALL
SELECT to_char(id)
, to_char(project_id)
, task_name
FROM eba_task_tasks;
And then I created a new tree with the defaults and customized the Tree query a bit (just added the links really):
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"NODE_NAME" as title,
null as icon,
"ID" as value,
null as tooltip,
'f?p=&APP_ID.:22:&SESSION.::NO::P22_ID,P22_PREV_PAGE:' || "ID" || ',3' as link
from "#OWNER#"."VIEW_TASKS_PROJECTS_TREE"
start with "PARENT_ID" is null
connect by prior "ID" = "PARENT_ID"
order siblings by "NODE_NAME"
Thanks man, you saved me a lot of time and headaches :)

Similar Messages

  • WEB ROE - Convert previous (RPCROEK0) data for storage in ROE Workbench

    Hi,
    We are in processing of moving to NEW VERSION (WEB ROE) version of ROE, activated BADI as required for switching from old ROE to new WEB ROE.I'm trying to execute SPRO node - Convert previous (RPCROEK0) data for storage in ROE Workbench, but in live run I'm getting error "Error writing to table T5KR1" is encountered. Please let me know how this can be resolved and what is causing this error in the system.
    Regards,
    Babu

    Look into note Note 635693 - ROE: Error in Conversion Report (RPCROEK0_CONVERSION).

  • Very Urgent--- How to Convert Non Valuated stk into Valuated

    Dear GURU'S
    Actually for a material A when i see the stock in MM03 in accounting tab i see less stock then when i see in MMBE
    i.e in MMBE if i select Material A and Plant B(Which is depo in my case) i see stock as 39
    but for same material MAterial A and Plant B ,if i see in MM03 --in accounting tab i m able to see less stock i.e only 1
    ============================================
    Well the problem is In MM03 I cud see only valuated stk i.e qty as 1
    And in MMBE for a partiocular material for a particular plant the stock was 39
    i.e Here i am getting Valuated + Non valuated stock
    i.e i am getting difference of 25
    =====>>>
    To get into the root cause
    I have gone to MB5B where i can get all the transaction that has been done on this material with movement type also i got the intial stock ,Goods recpt ,Goods  issu and total stock
    No for a particular material
    In MB5B it is showing
    Stock on 01.01.2005    =  38
    receipts total               = 238
    Issues total                  =237
    Stock as on 18.02.2008 = 39(which is equal to Stock in MMBE)
    =============>This is for valuated +Non valuated stock
    Where as if i want to see only valuated stock it was showing
    receipts total      = 238
    Issues total         =237
    Stock as on 18.02.2008 =1  (which is equal to stock in acctg view in MM03)
    ====================>This is only for Valuated Stock
    ======================================
    Now how to solve this :
    The initial qty(38) which has been posted it was at the begining that is at the start of the project
    And the people who have posted it ,it was non valuated
    that is the reason it is showing difference in MM03 and MMBE
    First thing
    How can i see on which date this initial stock has been posted
    Second Query
    How to convert this non valuated stock into Valuated stock
    So that the quantity in MMBE and MM03 gets matched
    Willl award 10 Points if my problem gets solved
    THANKZ IN ADVANCE
    REgds
    Shailesh

    Dear friend
    Actuallly i have checked the history of that particular Item in MB51
    I have gone through all the documents created for this material
    Now this material also exist in DEPO which is located at chennai and plant is at mumbai
    So Initially in the year-2006(31-10-2006) whater documents are created i.e STOP has  been created and delivery has been made (Mov type-601)
    are non valuated stock ,means they have been posted without any valuation
    But from year 2007(01.02.2007) the documents whiohc have been posted are valuated
    i.e is the reason when i am executing transaction MRN9 to check the history of valuated stock
    I cant see non valuated stock
    Well now how to do the valuation of this stock which have been posted in year 2006 so that
    In MMBE and MM03 there is no difference of stock
    Plz hepl
    regds
    shailesh

  • Convert string to date for Ms Access

    I have some date in a textFile!!!
    I get them via Buffered and FileReader into my java application and put them into a Vector!
    Every date is formatted as Strings and I want to convert them into a date format(YYYYMMDD).
    The date are not used for " System.out.println", but I want to insert them into a Access-database(use a jdbc/odbc bridge).
    The Access database seems only to accept YYYY-MM-DD, the only formatting way is how you choose to "show" the dates (short, long etc) but anyway....(:-)
    I�ve tried following example with format.getTime() and it works. But I want to insert the date from
    my textfiles instead.
    Here some examples from my code with the getTime()method!!!
    String str = String.valueOf(fields.get(3));
    String ar = str.substring(0,4)+"-";
    String m = str.substring(4,6)+"-";
    String d = str.substring(6,8);
    String datum = ar+m+d; //this is my date in a String format!!!
    Calendar calendar = new GregorianCalendar();
    Date date = calendar.getTime();//this objectref. takes the sys.date i want my string date instead(:-)
    DateFormat localFormat = DateFormat.getDateInstance();
    DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd" );//the only format for Access I think!
    for (int j=0; j<(fields.size()-1); j++){//pos. from my vector
    sql = sql + "'" + fields.get(j) + "'" + "," ;     
    sql = sql + "'" + format1.format( date ) "'" ; //the last field i the db
    db myTest = new db();
    myTest.executeDML("insert into tblBooks values "+sql+")");     
    Sorry for my "bumpy" English(:-) And thanks! Eva

    If you tell us what the format if the dates in the file is, we might be able to suggest something :)

  • Is there a PORTABLE wireless router that I could travel with to convert hotel LAN lines into wireless signals for my iPad?

    I travel regularly to Asia and I have been trying to compile everything I need into my iPad.  Unfortunately, most of my hotels do not have wireless in the rooms just an LAN line.  Does anyone know of a router (as small as possible) that I can plug an LAN line into that will convert it to a wireless signal I can access with the iPad.  What I don’t want is to have to plug the router into a computer and program it forevery different LAN line I encounter.  Thoughts???

    As the others have said, Airport Express is one option.  The catch as Allan said is that the configuration utility doesn't run on the iPad.  It is rumored that iOS5 may have the utlity, but that doesn't help you now.  If you can wait, then the Airport Express would arguably be the best for the iPad.
    If you can't wait, you could get the D-Link DAP-1350.  You configure it through a webpage, similar to how you would other home routers.
    http://www.dlink.com/products/?pid=DAP-1350
    I use the older DWL-G730AP 802.11g version and it's been very good to me for use by my Macbook Pro and iPad1.

  • How to convert non-unicode app into unicode ASO app

    I am using hyperion 11.1.1
    I would like to convert ASOsamp app into unicode app. can someone give me some direction. I have looked into DBAG but couldnt find anything useful.
    thanks in advance.

    thanks John,
    Also i would like to know about the Alias table in multiple language ? In Samp_U i see *.alt files on the server, how do we create that ? and then how do we view using those alias table. I set the Japanese alias table as active on the Samp_U database...and i was trying to view the retrieve in Japanese in Web Analysis but it didn't work. What wrong am I doing ?
    thanks for the help again.

  • Problems handling xml data for tree control.

    Hi,
    I have tried using tree control for displaying my xml data
    but I had a problem that i did not have labels in my xml data. A
    sample xml data is attached. So it displays the whole data at each
    level in the tree. The root label will be the entire the xml data
    and then one level down the remaining xml data and so on...
    How do i solve this issue i,e get the tags names itself as
    labels..
    Thanks in advance....

    An update after some efforts..
    Could get the folders perfectly i.e until the level of
    CPUTime perfectly but could not get the leaf: 32 since i used the
    following to set the label.
    I would like to know if there is a way to find out if a node
    is a leaf or folder and according set the label

  • Trying to convert a INDD doc into HTML/XML for Dreamweaver

    I have a CS3 IN doc...16.9 MB with READ and WRITE permissions. I have 60GB of disk available. When I try to CROSS-MEDIA EXPORT...it errors into:
    Exporting "myfilename.indd" as XHTML Failed.
    Couldn' create file "". There might not be sufficient space available or you man not have permission to create files in this location.
    HELP!
    Thanks, --bill

    I am talking about the location TO which you are saving when it comes to space available and permissions. You should be able to see where it is when chosing save or export, And free harddiskspace on the main disk you are working from. Is the destination on a server?

  • What are the Non SAP data sources supported for Analysis workbooks?

    AO 1.4 SP6
    BO 4.1 SP2
    What are the Non SAP data sources supported for Analysis workbooks?
    Thanks.

    HANA is a data source (which could contain non-SAP data)
    For other Excel front-ends that may connect to "non-SAP" data look at Live Office or Power BI by Microsoft - see Excel and Power BI connectivity to SAP BusinessObjects Universes | Power BI

  • Next Non Holiday date

    I need to find the next non holiday date for a set of rows in table.I have a separate table where all holidays are listed.Please help me to find the next non holiday date using decode function.
    Holiday Table sructure:
    create table holiday(no number,holidaydate date);
    insert into holiday values(1,to_date('17-AUG-2013','dd/mm/yyyy');
    insert into holiday values(1,to_date('05-SEP-2013','dd/mm/yyyy');
    I have a code which seems to be wrong.
    select decode (lapsedate ,
                                               laps.holidaydate , DECODE
                                                     (lapsedate +1,
                                                      laps.holidaydate + 1, DECODE
                                                              (lapsedate + 2,
                                                                 laps.holidaydate
                                                               + 2, lapsedate
                                                                + 3,
                                                               lapsedate + 2
                                                      lapsedate + 1
                                               lapsedate
                                              ) from dt;

    Hi,
    Here's one way to do that with your current tables:
    WITH    cntr       AS
        SELECT  LEVEL   AS n
        FROM    dual
        CONNECT BY   LEVEL <= 4 -- longest possible distance to next work day
    SELECT    m.ndate
    ,         m.ndate + MIN (c.n)   AS next_work_day
    FROM             mycalendar  m
    CROSS JOIN       cntr        c
    LEFT OUTER JOIN  holiday     h   ON  h.holidaydate = m.ndate + c.n
    WHERE     h.holidaydate  IS NULL
    AND       TO_CHAR ( m.ndate + c.n
                      , 'Dy'
                      , 'NLS_DATE_LANGUAGE=ENGLISH'  -- If needed (but never hurts)
                      )    NOT IN ('Sat', 'Sun')
    GROUP BY  m.ndate
    ORDER BY  m.ndate
    This assumes that the next work day (that is, non-holiday, Monday through Friday) will be within the next 4 days (which is true where I work).  You may need to change the magic number in cntr (4, above) depending on your holidays.
    Instead of a holiday table with 1 row per holiday, consider having a calendar table, with 1 row per day, regardless of whether the day is a holiday, weekend or work day.  You can have a next_work_day column in the table (populated by a query similar to the one above).  It will be more efficient in the long run, and will make coding individual queries much simpler.

  • Entry of non-English characters into the db

    Hi
    We are facing a problem in inserting non-English characters into the database.For example, we have a company name field which can accept German characters. This field has been defined as of varchar2 type of size 50 in the db. When we enter 49 English characters and then one German character, the database is throwing the error that the inserted value is too large for the column.Is it that the German character is taken as equivalent to two English characters ? Or is there any database level setting that can be done for this ? For the time being we have identified certain critical fields and have doubled the size of their fields in the db. But I guess there has to be another solution to this....
    Please help.
    null

    Indeed, your German character is using two bytes to store itself. Consult the Oracle JDBC Developer's Guide.
    null

  • Entry of non-English characters into database

    Hi
    We are facing a problem in inserting non-English characters into the database.For example, we have a company name field which can accept German characters. This field has been defined as of varchar2 type of size 50 in the db. When we enter 49 English characters and then one German character, the database is throwing the error that the inserted value is too large for the column.Is it that the German character is taken as equivalent to two English characters ? Or is there any database level setting that can be done for this ? For the time being we have identified certain critical fields and have doubled the size of their fields in the db. But I guess there has to be another solution to this....
    Please help.
    TIA
    Vinoj

    Indeed, your German character is using two bytes to store itself. Consult the Oracle JDBC Developer's Guide.
    null

  • How to convert cXML dtd files into xsd format and use them into BPEL application

    Hi,
    In my BPEL application I have to use cXML dtd files by converting them into xsd format.
    I have used 'Microsoft Visual Studio' for converting cXML.dtd file into xsd format, for this 1 dtd file I am getting three xsd files (cXML.xsd, cXML1.xsd and cXML2.xsd).
    Please check this once and let me know
    1. why I am getting three xsd files for one dtd file,
    2. how can I use cXML.xsd file in my application, do I ll have to use all the three files in my BPEL app and
    3. what should I include in main xsd file (cXML.xsd) to import other two xsd files.
    kindly check this once and let me know your suggestions .
    Thanks

    Hi,
    While downloading the cXML dtd there will be example xml files. Using this xml's we can generate xsd.
    Regards,
    KANN.

  • Key performance indicators (KPI) for material creation

    Dear all,
    I need to define some Key Performance Indicators (KPI’s) to measure the data quality during the material creation (MM01) process. The objective is to get concrete statistics about data quality/accuracy for fields related to material from all views created with MM01 (basic data, classification, unit of measure...).
    I would like to get your expertise on how to measure these KPI’s : which transactions, table (...) to use ?
    I have already few ideas :
    -Table CDHDR
    -Transaction MM04
    -Create “checkpoints“ into the workflow for material creation (ZWF01)
    Do you have any other idea in mind?
    I am open for all advices: transaction, table, process, approach…
    Thanks in advance for your help !

    I have a few ideas, but the accuracy of the master data is based on your system config.
    Some things that are helpful in most of the cases:
    - If material type is HAWA (trading goods) your procurement indicator should always be External procurement (check those for other material types if you have it uniformed). You can also check purchasing group based on material type if you have it distinct by material type.
    - Check if sales views are opened in all org.levels
    - Check if storage loc.views are opened for all SLoc
    All in all, you need to have a link of two or more data in material master to be able to check it in some way automatically, otherwise you won't be able to determine if the data is correct or not.
    E.g. How would you every know if lot size of 120.000 PCS is OK or not for a specific material or if you need to assign a specific purchasing group to your material.
    You know the logic behind your material master data best so you can create the best rules to check for your KPI.
    Regards.

  • Need to Convert Comma separated data in a column into individual rows from

    Hi,
    I need to Convert Comma separated data in a column into individual rows from a table.
    Eg: JOB1 SMITH,ALLEN,WARD,JONES
    OUTPUT required ;-
    JOB1 SMITH
    JOB1 ALLEN
    JOB1 WARD
    JOB1 JONES
    Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
    But I need to use a database independent solution
    Thanks in advance for your valuable inputs.
    George

    Go for ETL solution. There are couple of ways to implement.
    If helps mark

Maybe you are looking for

  • HPLaserJetService.exe has encountered a problem and needs to close.

    I continue to recieve an error message that states the following: HPLaserJetService.exe has encountered a problem and needs to close.  Right before the message appears my pc slows down and sometimes programs that i am in shut down. I have not issues

  • F.13-clearing, new problem

    HI Gurus I have a situation that I need to clear a GL acct based on the reference field. The items in the documents have a diff of 480$ so I put 500 as my tolerance in config- Define Tolerance Groups for G/L Accounts. The documents I am trying to cle

  • Best way of handling large amounts of data movement

    Hi I like to know what is the best way to handle data in the following scenario 1. We have to create Medical and Rx claims Tables for 36 months of data about 150 million records each - First month (month 1, 2, 3, 4, .......34, 35, 36) 2. We have to a

  • Runtime Sequence of triggers

    Is there any way to identify the runtime sequence of the execution of triggers in the form ? Also is there a place where the default (template) sequence of execution for forms triggers can be found ?

  • Grey screen with apple logo and buffering how to solve problem ?

    When starting my mac book pro it comes up with the grey screen with the apple logo and the buffering symbol , I have tried to reboot in safe mode and that doesn't work. I do not have my installation disc for the OS X 10.7.5 and was wondering if I use