Flattening hierarchy of 0COSTELMNT
Hi experts
We have the same scenario as described in this blog:
http://scn.sap.com/docs/DOC-48062
We only need node level 6 and 7 of cost element hierarchy.
I have applied the coding as of the blog, but the routine doesn't finish,
Is there any additional coding or corrections to make?
Thanks.
FIELD-SYMBOLS:
<RESULT_FIELDS> TYPE _ty_s_TG_1.
DATA:
MONITOR_REC TYPE rstmonitor.
*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
* raise exception type CX_RSROUT_ABORT.
TYPES: BEGIN OF lty_final,
COSTELMNT TYPE RSSHNODENAME,
lvl6_nodname TYPE RSSHNODENAME,
lvl7_nodname TYPE RSSHNODENAME,
END OF lty_final.
DATA: lw_costel TYPE /BI0/HCOSTELMNT,
lw_costel1 TYPE /BI0/HCOSTELMNT,
lw_final TYPE lty_final,
lt_final TYPE STANDARD TABLE OF lty_final,
lv_hieid TYPE rshieid,
lt_costel TYPE STANDARD TABLE OF /BI0/HCOSTELMNT,
lt_costel1 TYPE STANDARD TABLE OF /BI0/HCOSTELMNT,
lv_parentid TYPE rsparent,
lv_strlen TYPE n LENGTH 2.
CLEAR: lw_costel1, lw_costel, lw_final, lv_parentid.
SELECT SINGLE hieid
FROM /BI0/HCOSTELMNT
INTO lv_hieid
WHERE nodename = 'PRIM' AND OBJVERS = 'A'.
IF sy-subrc NE 0.
CLEAR lv_hieid.
ELSE.
SELECT * FROM /BI0/HCOSTELMNT
INTO TABLE lt_costel
WHERE hieid EQ lv_hieid.
IF sy-subrc EQ 0.
lt_costel1[] = lt_costel[].
SORT lt_costel1 BY nodeid.
SORT lt_costel BY iobjnm DESCENDING tlevel DESCENDING.
LOOP AT lt_costel INTO lw_costel WHERE iobjnm =
'0COSTELMNT'.
CLEAR lv_parentid.
lv_parentid = lw_costel-parentid.
lw_final-costelmnt = lw_costel-nodename.
DO.
READ TABLE lt_costel1 INTO lw_costel1 WITH KEY nodeid =
lv_parentid.
CASE lw_costel1-tlevel.
WHEN '06'.
lw_final-lvl6_nodname =
lw_costel1-nodename.
WHEN '07'.
lw_final-lvl7_nodname =
lw_costel1-nodename.
ENDCASE.
CLEAR lv_parentid.
IF lw_costel1-parentid IS NOT INITIAL.
lv_parentid = lw_costel1-parentid.
ELSE.
EXIT.
ENDIF.
ENDDO.
APPEND lw_final TO lt_final.
CLEAR: lw_final.
ENDLOOP.
ENDIF.
ENDIF.
LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.
READ TABLE lt_final INTO lw_final
WITH KEY costelmnt = <result_fields>-costelmnt.
<result_fields>-CO_AREA = <result_fields>-CO_AREA.
<result_fields>-DATETO = <result_fields>-DATETO.
<result_fields>-DATEFROM = <result_fields>-DATEFROM.
<result_fields>-CSTELMNTYP = <result_fields>-CSTELMNTYP.
<result_fields>-LOGSYS = <result_fields>-LOGSYS.
<result_fields>-UNIT = <result_fields>-UNIT.
<result_fields>-/BIC/ZCOST_REL =
<result_fields>-/BIC/ZCOST_REL.
<result_fields>-/bic/zlevel6 = lw_final-lvl6_nodname.
<result_fields>-/bic/zlevel7 = lw_final-lvl7_nodname.
APPEND <result_fields> TO RESULT_PACKAGE.
ENDLOOP.
Hi Suhas
So firstly, extend the length of lw_final-costelmnt. It should be equal to the lngth of the Cost El IOBJ plus the length of the Controlling Area.
This is already the nodename of costel IOBJ including the controlling area:
I think I already have the right length with:
LOOP AT lt_costel INTO lw_costel WHERE iobjnm =
'0COSTELMNT'.
CLEAR lv_parentid.
lv_parentid = lw_costel-parentid.
lw_final-costelmnt = lw_costel-nodename.
DO.
READ TABLE lt_costel1 INTO lw_costel1 WITH KEY nodeid =
lv_parentid.
CHECK sy-subrc = 0.
CASE lw_costel1-tlevel.
WHEN '01'.
lw_final-lvl1_nodname =
lw_costel1-nodename.
WHEN '02'.
lw_final-lvl2_nodname =
lw_costel1-nodename.
Similar Messages
-
Flatten Hierarchy By Filtering Out Unnecessary Limbs
We have numerous hierarchies in our organization that faciliate various reporting views. Some of those views are slight variations of one another. One common theme that we have encountered is the need for the same basic view, but with less granularity in terms of rollups.
Example (alphas are limbs, numerics are leafs):
Master Hierarchy
A
B
C
1
2
D
3
4
E
5
6
We need to derive a custom export that eliminates all the in-between nodes and just rolls all the leafs up to Node A.
A
1
2
3
4
5
6
This type of flattening may happen at any level within the hierarchy (not necessary all rolling up to the top level). So we need a somewhat dynamic way to achieve this. I am thinking that a property could be built to flag certain key levels that are required for the custom export, but still not sure how to get those key levels flagged as parents for the leafs, regardless of which level the leaf is at in the Master hierarchy.
Any thoughts?Hi Denzz,
What kind of OR condition could be written that would not only filter certain limb nodes out, but also realign the parent/child relationships accordingly. For example:
Master Hierarchy
A
B
C
1
2
D
3
4
E
5
6
We need to derive a custom export that eliminates rollups C & D.
A
B
1
2
3
4
E
5
6
I can understand creating a formula/property to filter in or out certain rollups. But we would also need to effectively change the parent value of 1, 2, 3, 4 to B (instead of C or D). Are you suggesting a formula that checks the immediate parent for the filter property, and if not found, then go to grandparent, then next grandparent and so on until found? -
I have the following recursive query:
SELECT SYS_CONNECT_BY_PATH(object_name, '\') AS path
FROM user_group_nodes
START WITH parent_id = '2892107544AA2278166C1AA8D123E761'
CONNECT BY parent_id = PRIOR object_id
ORDER SIBLINGS BY object_name;
Which returns the following sample dataset:
\UserGroupA\UserGroupAA\UserGroupAAA\JaneDoe
\UserGroupA\UserGroupAA\UserGroupAAA\UserGroupAAAA\UserGroupAAAAA\JohnDoe
Based on the above sample dataset, I need to insert the following records into a table:
Group
User
UserGroupA
JaneDoe
UserGroupAA
JaneDoe
UserGroupAAA
JaneDoe
UserGroupA
JohnDoe
UserGroupAA
JohnDoe
UserGroupAAA
JohnDoe
UserGroupAAAA
JohnDoe
UserGroupAAAAA
JohnDoe
Can someone provide direction on how to accomplish this? I'm leaning towards using a cursor, but I'm hoping there is another option that performs better since I need to do this across 10,000 users and 1,500 groups.One way:
--==============================================================================================
WITH t AS
(SELECT '\UserGroupA\UserGroupAA\UserGroupAAA\JaneDoe' str FROM DUAL
UNION ALL
SELECT '\UserGroupA\UserGroupAA\UserGroupAAA\UserGroupAAAA\UserGroupAAAAA\JohnDoe'
FROM DUAL),
tt AS
(SELECT LTRIM (SUBSTR (str, 1, INSTR (str, '\', -1) - 1), '\') str,
SUBSTR (str, INSTR (str, '\', -1) + 1) val
FROM t)
SELECT str,
REGEXP_SUBSTR (str,
'[^\]+',
1,
LEVEL)
split_str,
val
FROM tt
CONNECT BY LEVEL <= LENGTH (str) - LENGTH (REPLACE (str, '\')) + 1
AND PRIOR str = str
AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL;
--====================================================================================
Output:
STR
SPLIT_STR
VAL
UserGroupA,UserGroupAA,UserGroupAAA
UserGroupA
JaneDoe
UserGroupA,UserGroupAA,UserGroupAAA
UserGroupAA
JaneDoe
UserGroupA,UserGroupAA,UserGroupAAA
UserGroupAAA
JaneDoe
UserGroupA,UserGroupAA,UserGroupAAA,UserGroupAAAA,UserGroupAAAAA
UserGroupA
JohnDoe
UserGroupA,UserGroupAA,UserGroupAAA,UserGroupAAAA,UserGroupAAAAA
UserGroupAA
JohnDoe
UserGroupA,UserGroupAA,UserGroupAAA,UserGroupAAAA,UserGroupAAAAA
UserGroupAAA
JohnDoe
UserGroupA,UserGroupAA,UserGroupAAA,UserGroupAAAA,UserGroupAAAAA
UserGroupAAAA
JohnDoe
UserGroupA,UserGroupAA,UserGroupAAA,UserGroupAAAA,UserGroupAAAAA
UserGroupAAAAA
JohnDoe
Note: I hope you got it that you need to replace that with clause of t with your query.
Cheers,
Manik. -
Different elements of different levels of hierarchy
Hi experts,
I have a question about hierarchies obiee 11g.
I need to do a table that contains (plain text, without '+' to drill-down) different elements of different levels of hierarchy
I have a hierarchy Account like this:
Level1
-----Level2
-------Element1Level2
-------Element2Level2
------------Level3
--------------Element1Level3
-------Element3Level2
My assignment is to do a table like this
Level1---------------
Element2Level2--
Element1Level3--
Element3Level2--
So I don't want to drill-down on Element2Level2 to see Elements of Level3...
How can I achieve this??
Thanks!If I a not wrong, you basically want to flatten out a hierarchy. You should be able to do it using the Parent-child hierarchy concept newly introduced in OBIEE 11g where the RPD generates the DDL and DML for you, but you might have to build out an intermediate table to source the final flattened hierarchy table. Refer to this link which has a great example. ( http://prasadmadhasi.com/2011/11/15/hierarchies-parent-child-hierarchy-in-obiee-11g/ )
Thanks,
-Amith. -
Exporting picture with only the bottom of a keyword hierarchy
Hi,
I am exporting my pictures to be shown in a wordpress blog. I set up wordpress in a way to use the meta data. I have a hierarchy for people "People > private > Paul". What I get now in wordpress is the flattened hierarchy. What I want to see is "Paul". Is it possible to achive this somehow? The checkboxes do not seem to do the trick.
Thanks!If you only want the bottom (last) keyword to be exported you'll have to setup the keywords higher up the hierarchy as non exportable. Right click the containing keyword and choose Edit Keyword from context menu.
Also, make sure that the Export window option to write the Lightroom keyword hierarchy is unchecked. -
Help required in Getting XML output as Required
Hi All,
I have below xml
INSERT INTO XMLTABLE VALUES (4,'<?xml version="1.0"?>
<Node_1 empID="202" empName="Pro1" oper="Update">
<Node_2 empID="20" empName="Pro2" oper="Update">
<Bode_3 empID="2" empName="Pro3" oper="Update">
<Bode_4 empID="22" empName="Pro4" oper="Update">
<Bode_5 empID="12" empName="Pro5" oper="Delete"/>
<Bode_6 empID="223" empName="Pro6" oper="Insert"/>
<Bode_7 empID="201" empName="Pro7" oper="All"/>
<Node_3 empID="21" empName="Pro71" oper="ll">
</Bode_4>
</Bode_3>
</Node_2>
</Node_1>');
I have a sequence seq_i
seq_i start with 1 increment by 1
am able to display output as below,
Node|EMPID|OPER|EMPNAME|MGRID
Node_1|202|Update|Pro1|Null
Node_2|20|Update|Pro2|Node_1
Bode_3|2|Update|Pro3|Node_2
Bode_4|22|Update|Pro4|Bode_3
Bode_5|12|Delete|Pro5|Bode_4
Bode_6|223|Insert|Pro6|Bode_4
Bode_7|201|All|Pro7|Bode_4
Node_3|21|ll|Pro71|Bode_4
Now I want below one as output
All nodes starting with Bode_, I need to replace that with sequence, seq_i
so for the seq_i (starting with i and incrementing by 1)
Please note when ever node changes to sequence, corresponding mgrid also changes,
Node|EMPID|OPER|EMPNAME|MGRID
Node_1|202|Update|Pro1|Null
Node_2|20|Update|Pro2|Node_1
1|2|Update|Pro3|Node_2
2|22|Update|Pro4|1
3|12|Delete|Pro5|2
4|223|Insert|Pro6|2
5|201|All|Pro7|2
Node_3|21|ll|Pro71|2
Please let me know your thoughts on this to acheive the same,
Thanks,Well you've already said you can get your XML into the initial flattened hierarchy structure, so you just need to manipulate that to assign a sequence (row number) as appropriate.
Something like...
SQL> ed
Wrote file afiedt.buf
1 with t as (
2 select 'Node_1' as node, 202 as empid, 'Update' as oper, 'Pro1' as empname, Null as mgrid from dual union all
3 select 'Node_2', 20, 'Update', 'Pro2', 'Node_1' from dual union all
4 select 'Bode_3', 2, 'Update', 'Pro3', 'Node_2' from dual union all
5 select 'Bode_4', 22, 'Update', 'Pro4', 'Bode_3' from dual union all
6 select 'Bode_5', 12, 'Delete', 'Pro5', 'Bode_4' from dual union all
7 select 'Bode_6', 223, 'Insert', 'Pro6', 'Bode_4' from dual union all
8 select 'Bode_7', 201, 'All', 'Pro7', 'Bode_4' from dual union all
9 select 'Node_3', 21, 'All', 'Pro71', 'Bode_4' from dual
10 )
11 -- end of test data obtained from flattening XML - just use query below against own data
12 select rpad(' ',(level-1)*2,' ')||coalesce(bode_no, node) as tree
13 ,coalesce(bode_no, node) as node
14 ,empid
15 ,oper
16 ,empname
17 ,case when bode_no is not null then prior coalesce(bode_no, node) else mgrid end as mgrid
18 from (
19 select node
20 ,case when node like 'Bode%' then
21 to_char(row_number() over (partition by case when node like 'Bode%' then 1 else 0 end order by node))
22 else null
23 end as bode_no
24 ,empid
25 ,oper
26 ,empname
27 ,mgrid
28 from t
29 )
30 connect by mgrid = prior node
31* start with mgrid is null
SQL> /
TREE NODE EMPID OPER EMPNA MGRID
Node_1 Node_1 202 Update Pro1
Node_2 Node_2 20 Update Pro2 Node_1
1 1 2 Update Pro3 Node_2
2 2 22 Update Pro4 1
Node_3 Node_3 21 All Pro71 Bode_4
3 3 12 Delete Pro5 2
4 4 223 Insert Pro6 2
5 5 201 All Pro7 2
8 rows selected. -
PATH() issue - The Value 'Val123' has multiple values
Im using PATH() to get a flattened hierarchy. I keep getting the following error:
Calculation error in column 'Detail'[]: Each value in 'Detail'[UniqueID] must have the same value in 'Detail'[ParentTest]. The value 'A00012:A123' has multiple values.
I know with 100% certainty that there are not multiple values for A00012:A123.
I have also copied the data ( from the powerpivot Designer) to another workbook and cannot reproduce the issue.
Can anyone advise what might be going on here? Im using Excel 2010 32bit, if its any use. If i can supply any further information please let me know.
ThanksI found the issue. In a seperate set of rows there was a duplicate. the rows had nothing to do with the rows that were actually mentioned in the error message. so a cause has been identified.
Thanks -
GL Balances with segment Hierarchies in Discoverer
Does anyone here have the need to report on GL balances using the Account segment hierarchies?
The only way users can utilize the GL segment hierarchies is through FSG reporting and some other products such as DBI and EPF.
Each segment in GL accounting flexfield can have one or multiple hierarchies and the hierarchies are defined as parent child relationship in the FND_FLEX_NORM_HIERARCHY table. Because of the nature of the way these hierarchy is defined in GL it cannot be directly consumed for Discoverer reporting.
To take advantage of these hierarchies in Discoverer, I have developed a solution that flattens the hierarchies in one go and the flattened hierarchy can then be mapped to Discoverer hierarchies. Once this is established, users can truly benefit from Drilling down and rolling up feature of discoverer hierarchy and I have seen users just love this feature. I am sure this can be adapted to OBIEE too.
If you would like to know more about this solution, please let me know njethwa @ gmail . com
Thanks and Regards
Nilesh
http://www.infocaptor.comYou can find the code and documentation here
http://www.infocaptor.com/dashboard/gldisco
Design Dashboards -
Flatten family hierarchy to level 2, level 3, level 4 across
For example....
Family Hierarchy
Grandma 1
Mom 1
daughter 1
Grand daughter 1
Great Grand daughter 1
How do you flatten this one Field to say
Grandma Mom Daughter
Grandma 1 Mom1 Daughter 1 ect.... across the top
Do you create a selection in the row pane or a formula for the same field several times? Thanks!!!!Hello Experts,
I am also facing the same issue.I want to get a flat file output from BW system which
includes the hierarchy fields from 2 different hierarchies as columns of flat file with some other fields.
Is there any way to do this ?
Regards,
Vikas Arya -
How to write SQL query to flatten the hierarchy
Hi,
I have person table which has recursive hierarchy and I wish to flatten it upto 5 levels.
I am using Oracle10g and I have written following query to flatten the hierarchy
SELECT
ID,
level lvl,
REGEXP_SUBSTR (SYS_CONNECT_BY_PATH (fname||' '||lname, '/'), '[^/]+', 1, 1) AS level_1,
REGEXP_SUBSTR (SYS_CONNECT_BY_PATH (fname||' '||lname, '/'), '[^/]+', 1, 2) AS level_2,
REGEXP_SUBSTR (SYS_CONNECT_BY_PATH (fname||' '||lname, '/'), '[^/]+', 1, 3) AS level_3,
REGEXP_SUBSTR (SYS_CONNECT_BY_PATH (fname||' '||lname, '/'), '[^/]+', 1, 4) AS level_4,
REGEXP_SUBSTR (SYS_CONNECT_BY_PATH (fname||' '||lname, '/'), '[^/]+', 1, 5) AS level_5
FROM cmt_person
CONNECT BY manager_id = PRIOR id
and level<=5
The person table have more than a million records.
Here I am getting the correct output but this query is taking a lot of time to run.
I am looking at a SQL query without use of connect by to get the required output.
To recreate the issue, you can use this query in HR schema of Oracle and use Employees table.
Any help would be greatly appreciated.
Thanks,
RaghvendraI tried to rewrite the query without using regular expression and connect by. Here is the code:
SELECT
cmt_person.id ,
cmt_person.fname as mgr1,
case when cmt_person2.manager_id=cmt_person.id then (cmt_person2.fname ) end as mgr2,
case when cmt_person3.manager_id=cmt_person2.id then (cmt_person3.fname ) end as mgr3,
case when cmt_person4.manager_id=cmt_person3.id then cmt_person4.fname end as mgr4,
case when cmt_person5.manager_id=cmt_person4.id then cmt_person5.fname end as mgr5
FROM
cmt_person,
cmt_person cmt_person2,
cmt_person cmt_person3,
cmt_person cmt_person4,
cmt_person cmt_person5
WHERE
cmt_person2.manager_id(+)=cmt_person.id and
cmt_person3.manager_id(+)=cmt_person2.id and
cmt_person4.manager_id(+)=cmt_person3.id and
cmt_person5.manager_id(+)=cmt_person4.id
order by 2,3,4
I got following output:
emplo000000000200100 Bobby Khasha Rahul Rajesh
emplo000000000200099 Bobby Khasha Rahul Ajay
emplo000000000200101 Bobby Khasha Rahul Swati
emplo000000000200320 Bobby Khasha Rahul Jinesh
emplo000000000201231 Bobby Khasha Test123
emplo000000000201230 Bobby Khasha User1_Domain
emplo000000000201227 Bobby Khasha User1_World
emplo000000000200104 Bobby Khasha Yitzik Natalia
emplo000000000200103 Bobby Khasha Yitzik Andrew
total 9 rows
But this is partially correct output. I want output like this:
emplo000000000200097 Bobby
emplo000000000200087 Bobby Khasha
emplo000000000200102 Bobby Khasha Yitzik
emplo000000000200103 Bobby Khasha Yitzik Andrew
emplo000000000200104 Bobby Khasha Yitzik Natalia
emplo000000000201227 Bobby Khasha User1_World
emplo000000000201231 Bobby Khasha Test123
emplo000000000201230 Bobby Khasha User1_Domain
emplo000000000200098 Bobby Khasha Rahul
emplo000000000200099 Bobby Khasha Rahul Ajay
emplo000000000200100 Bobby Khasha Rahul Rajesh
emplo000000000200320 Bobby Khasha Rahul Jinesh
emplo000000000200101 Bobby Khasha Rahul Swati
total 13 rows
Do you know what I should do to get this output.
Thanks,
Raghvendra -
Flattened to Parent Child Hierarchy
Hi,
My client has a little different requirement from normal.
We want to convert the flattened version of hierarchy to parent child format. Does anyone have any sql script or idea how we can achieve this quickly?
Thanks in advance.http://www.rittmanmead.com/2007/06/21/obiee-data-modeling-tips-3-ragged-hierarchies/
might be helpful. -
I'm trying to flatten a hierarchy. I have a table with a parent/child relationship in the following order
Parent_ID Child_ID
1234 1234
1234 1235
1235 1236....etc
I would like to transform the hierarchy to
1234 , 1235, 1236
If I use a sys_connect_by I get
1234;
1234;1235
1235;1235;1236
Thanks
KhetaniStarting from Oracle 10 you can use CONNECT_BY_ISLEAF operator to filter out unwanted rows:
WITH HIERARCHY AS (
SELECT LEVEL + 1233 PARENT_ID, LEVEL + 1233 + 1 CHILD_ID
FROM DUAL CONNECT BY LEVEL < 6
SELECT SYS_CONNECT_BY_PATH( PARENT_ID, ';') PARENT_ID
FROM HIERARCHY
WHERE CONNECT_BY_ISLEAF = 1
START WITH PARENT_ID = 1234
CONNECT BY PRIOR CHILD_ID = PARENT_ID;
PARENT_ID
;1234;1235;1236;1237;1238 -
How to flatten keyword hierarchy?
For about a year I had all my keywords organized into a nice hierarchy, but after moving projects between libraries and computers my keywords are in chaos because keyword hierarchy information is not included in exported projects. I have keywords repeated with one nested in a folder and its copy sitting at the top level (with photos assigned to both).
After seeing what a mess moving projects causes, I'd like to eliminate the hierarchies and just keep a flat list. Does anyone know of a way to flatten the structure without having to drag each keyword out of its folder? I tried deleting the Keywords.plist file, but it gets rebuilt with the hierarchy intact. Any help is appreciated!One thing that might be a factor is the way Aperture keeps keywords active even if you move or delete them in the keywords list.
In order to have control over your keyword list, you need to delete existing keywords from your images. As Steve Weller points out in his articles, Aperture keeps keyword information in several places, not just the keyword list, and you need to deal with all of the places in order to control the hierarchy of the keyword list. For example, if you have set up custom keyword buttons, they store the keyword in the hierarchy of the time the button was created, so each time you use the button, you are making Aperture "remember" the hierarchy, even if you have later moved the keyword.
But your issue is that you have many images using keywords. When a keyword is used in an image, it is stored with the image; Aperture remembers the hierarchy of the keyword. This means that if you later move that keyword in the keyword list, Aperture considers the moved keyword to be separate and independent of the keyword previously used with an image. You can see this in the smart album display of keywords, which is based on actually used keywords. If you are having this problem, then keywords will appear more than once in the smart album keyword list. If you want to keep the same spelling of a keyword that has been moved in the keyword list, the only solution I know of is, frankly, a bit tedious:
1. use the smart album to select all images using the unwanted version of the keyword
2. then assign an "intermediate" (not identically spelled) keyword to those images,
3. then delete the unwanted version of the keyword from the images (use the keyword field in the control bar; option-tilde or click on the field, then type the name of the unwanted keyword, then shift-return to delete the keyword)
4. then assign the new version of the keyword to the images
5. then delete the intermediate keyword
Good luck! -
Want to flatten my parent-child hierarchy into an level-based hierarchy.
Hi Expert,
Can anyone let me know how I can convert my parent-child hierarchy into an LEVEL-based hierarchy.
Thanks in Advance
SIf you have an Oracle DB have a look on the CONNECT BY PRIOR functionality.
regards
John
http://obiee101.blogspot.com -
Flattening the hierarchial data
Hi,
I have the data in this format
ID NAME ParentID
CV1 CV1NAME CV
CVX1 CVX1NAME CV1
CVXX1 CVXX1NAME CVX1
CV2 CV2NAME CV
CVX2 CVX2NAME CV2
CVXX2 CVXX2NAME CVX2
How can i flatten this data into this format
CVID CVNAME CVXID CVXNAME CVXXID CVXXNAME
cv1 cv1name cvx1 cvx1name cvxx1 cvxx1name
cv2 cv2name cvx2 cvx2name cvxx2 cvxx2nameDECLARE @table TABLE (ID varchar(10), NAME varchar(20), ParentID varchar(10))
INSERT INTO @table (ID, NAME, ParentID) VALUES
('CV1', 'CV1NAME', 'CV'),
('CVX1', 'CVX1NAME', 'CV1'),
('CVXX1', 'CVXX1NAME', 'CVX1'),
('CV2', 'CV2NAME', 'CV'),
('CVX2', 'CVX2NAME', 'CV2'),
('CVXX2', 'CVXX2NAME', 'CVX2')
SELECT
t0.ID AS CVID,
t0.NAME AS CVNAME,
t1.ID AS CVXID,
t1.NAME AS CVXNAME,
t2.ID AS CVXXID,
t2.NAME AS CVXXNAME
FROM
SELECT ID, NAME, RIGHT(ID, 1) AS Num
FROM @table
WHERE ID LIKE 'CV[1-9]'
) AS t0
FULL JOIN
SELECT ID, NAME, RIGHT(ID, 1) AS Num
FROM @table
WHERE ID LIKE 'CVX[1-9]'
) AS t1 ON t1.Num = t0.Num
FULL JOIN
SELECT ID, NAME, RIGHT(ID, 1) AS Num
FROM @table
WHERE ID LIKE 'CVXX[1-9]'
) AS t2 ON t2.Num = t0.Num
A Fan of SSIS, SSRS and SSAS
Maybe you are looking for
-
I have re-loaded itunes but my phone is not showing. I have run diagnostics on it as well but the tests show that the ports cannot find the device. Any suggestions are gratefully received. Thanks.
-
PhP/MySQL Horizontal/Vertical Repeat Region
Hi Guys, I'm pretty sure this question would have been asked many times before. If so, first of all my apologies for re-posting this. Anyway, what I'm trying to do is create a repeat region that spans for 4 columns and then repeats the rest in rows.
-
Issuse with WebDynpro iViews - Java or ABAP
We frequently get calls from users who complain that they can't see a screen in the portal, and it is usually because they have accidentally collapsed an iView. The problem we have found is that it doesn't seem to work with WebDynpro iViews - Java or
-
DAQmx: Numerical indicators go blank intermittently using DAQmx Read
Hello everyone, I was wondering if anyone else has ever fought this issue and won. I have a loop (I will attempt to attach an image of the block diagram) which performs a DAQmx Read operation. The loop employs a 200 millisecond wait. The loop scal
-
Cloning DB on a different server from RMAN Tape backup
RDBMS version : 11.2.0.2 on Solaris 10 Media Management Layer : Netbackup v7 I have done only backups to Tape. I have never done restore,recovery from Tape. We have a production DB named NEHPROD running on server qualmh214. Every Monday mor