Hierarchy in queries
Hi,
I am not able to view the Hierarchy structure in the analyzer when i execute the query?
Regards
Sheela
Hi Sheela
Thanks.
In Analyzer report, Select a Chara Say Cost Center,, rt Click> Query Properties> Data display there u can see, the hierarchy structure or display as Multidimensional.
There u can see on the fly hierarchy structure.
But according to ur question, u wanted to generate Hierachy, u wud hav to Activate them first in Query Designer. Only after which it shall displayed by a Arrow in analyser.
Regards.
Similar Messages
-
Tricky query with multiple hierarchial sub queries
Here's a pussle that I cannot solve. Who can help me?
Given table F (records form a binary tree with levels 0, 1, and
2):
Id IdParent
F1 null
F2 F1
F3 F2
F4 F2
F5 F1
F6 F5
F7 F5
and given table D (records form a similar binary tree with
levels 0, 1, and 2):
Id IdParent
D1 null
D2 D1
D3 D2
D4 D2
D5 D1
D6 D5
D7 D5
and given table P (cross referencing tables F and D):
IdF IdD
F2 D6
F3 D2
F5 D7
and given table S (which holds the seed to the query):
IdF
F3
and given table I (just any collection of records that reference
table D which we want to select records from):
Id IdD
I1 D1
I2 D2
I3 D3
I4 D4
I5 D5
I6 D6
I7 D7
I8 D1
I9 D5
all together being related like in figure 1:
S.IdF =>> F.Id
F.Id <- P.IdF
P.IdD -> D.Id
D.Id <<= I.IdD
where =>> denotes 'is or is a descenden of'
and -> denotes 'is'
I want to build a query that lets me select all records from
table I, which reference table D, such that the referenced
records in table D are hierarchial descendents of any record
that is referenced by records in table P, for which they
reference records in table F, which are ancestors to records
referenced by records in table S.
If it wasn't for the hierarchial approach on both sides of the
cross referencing table, matters would have been easy. Then the
releational map would have been like in figure 2:
S.IdF <- P.IdF
P.IdD -> I.IdD
and the query would have been:
SELECT I.Id
FROM I, P, S
WHERE I.IdD = P.IdD
AND P.IdF = S.IdF
So in what I am looking for, you may say that the '='-signs in
this select statement should denote 'is or is a descenden of'
going towards the side of table P.
Given the tables listed above and given the query I am seeking,
I expect to retrieve the following result set:
I.Id
I2
I3
I4
I6
Tricky, eh? I belive the figures are the best angles to
understand this problem.You do this with subqueries and hierarchical queries...
First the hierarchal subquery on F...
SQL> SELECT f.id
2 FROM f
3 CONNECT BY PRIOR f.idp = f.id
4 START WITH f.id IN ( SELECT idf FROM s )
5 ;
ID
F3
F2
F1
Then join with the cross reference table...
SQL> SELECT p.idd
2 FROM p
3 , ( SELECT f.id
4 FROM f
5 START WITH f.id IN ( SELECT idf FROM s )
6 CONNECT BY PRIOR f.idp = f.id
7 ) s
8 WHERE s.id = p.idf
9 ;
ID
D6
D2
Use this as a subquery in a hierarchial query for the
descendents in D...
SQL> SELECT d.id
2 FROM d
3 START WITH d.idd IN ( SELECT p.idd
4 FROM p
5 , ( SELECT f.id
6 FROM f
7 START WITH f.id IN ( SELECT
idf FROM s )
8 CONNECT BY PRIOR f.idp = f.id
9 ) s
10 WHERE s.id = p.idf
11 )
12 CONNECT BY PRIOR d.id = d.idp
13 ;
ID
D2
D3
D4
D6
Then use that as a subquery to return the I result set...
SQL> SELECT i.id
2 FROM i
3 WHERE i.idd IN ( SELECT d.id
4 FROM d
5 START WITH d.id IN ( SELECT p.idd
6 FROM p
7 , ( SELECT
f.id
8 FROM f
9 START
WITH f.id IN ( SELECT idf FROM s )
10 CONNECT
BY PRIOR f.idp = f.id
11 ) s
12 WHERE s.id = p.idf
13 )
14 CONNECT BY PRIOR d.id = d.idp
15 )
16 ;
ID
I2
I3
I4
I6Good Luck... -
Restricting access for top Hierarchy in queries
Hello all,
Since we have a top hierarchy that comes from R/3 in which every company from our organization is attached, is there any way to restrict users access in the queries and authorizations so that when a user runs a query and tries to access nodes (cost or profit centers or other companies) that are restricted for him/her the "Authorization Not allowed" message displays. We know that the companies can not be treated as 0co_code but as nodes and We also know that in the Role modification we can put all this detail, but this will increase in a manual maintenace process, because everytime there's a new cost or profit center a manual maintenance must be done.
We want to have an automatic process since the hierarchy comes from R/3.
Thanks for your help!!
Mrs. Eyda MuñozHi,
You can try look at transaction RSSM and at the very bottom there is a button "fr. hierarchy". This is where you can specify the levels and nodes to restrict to. Then you have to set up a profile in PFCG to provide the restriction.
http://help.sap.com/saphelp_nw04/helpdata/en/80/1a689ae07211d2acb80000e829fbfe/content.htm - this should be able to provide some form of basic understanding.
Hope this helps.
Cheers,
Gim -
Hierarchy in Queries (Where-used-list)
All,
We have hierarchies in many BW reports. Is it possible to get a where-used-list of hierarchy. Ex. Hierarchy A is used in which reports?
Any idea?
Thanks in advance!hi Ann,
take a look some sample code for this kind of where-used list in query (free char, navigational attribute etc)
Query Issues
Link technical name and query name
Where-used list of an attribute (either display or navigational)
... will try to code for the hierarchy later...
hope this helps. -
Hierarchy/heirarchical queries/query start with connect
ok... I have seen many examples of using hierachical queries. All of the example has parent as null and children with 1 parent. I haven't seen any query that queries a child with multiple parents.
For example.
Table A:
Child--Parent
1--null
2--1
3--1
3--2
4--3
5--2
Select query:
Select child, level
from A
start with child = 3
connect by prior child = parent
Result
Child--Level
3--1
4--2
3--1
4--2
Notice that it display the child '3' twice. Its because it has 2 different parent.
My question is that, how do I make the query to display this iteration once?Hi, Sentinel,
I'd love to see a solution that simple, but I don't think it's possible.
Suppose you want to see child=2 and all it's descendants:
--<"begin sample data">
with a as (select 1 child, null parent from dual
union all select 2, 1 from dual
union all select 3, 1 from dual
union all select 3, 2 from dual
union all select 4, 3 from dual
union all select 5, 2 from dual
--<"cut here">
Select child, level
from (select child, min(parent) parent from a group by child)
start with child = 2
connect by prior child = parent;Produces this output:
CHILD LEVEL
2 1
5 2I believe OP wants to get this for the descendants of child=2:
CHILD LEVEL
2 1
5 2[b]
3 2
4 3So what happened to child=3? For child=3, MIN (parent) = 1, according to this query. That's true when the universe is the entire table, but we're only interested in child=2 and its descendants.
Message was edited by:
Frank Kulash
By the way, the comments
--<"begin sample data">
and
--<"cut here">
are brilliant! -
Top n analysis using hierarchial queries
hi all,
can we do top n analysis in hierarchial queries using level pseudo columns. if so please give an example.
thanks and regards,
sri ram.Hi,
Analytic functions (such as RANK) often interfere with CONNECT BY queries. Do one of them in a sub-query, and the other in a super-query, as shown below.
If you do the CONNECT BY first, use ROWNUM (which is assigned after ORDER SIBLINGS BY is applied) to preserve the order of the CONNECT BY query.
WITH connect_by_results AS
SELECT LPAD ( ' '
, 3 * (LEVEL - 1)
) || ename AS iname
, sal
, ROWNUM AS r_num
FROM scott.emp
START WITH mgr IS NULL
CONNECT BY mgr = PRIOR empno
ORDER SIBLINGS BY ename
SELECT iname
, sal
, RANK () OVER (ORDER BY sal DESC) AS sal_rank
FROM connect_by_results
ORDER BY r_num
;Output:
INAME SAL SAL_RANK
KING 5000 1
BLAKE 2850 5
ALLEN 1600 7
JAMES 950 13
MARTIN 1250 10
TURNER 1500 8
WARD 1250 10
CLARK 2450 6
MILLER 1300 9
JONES 2975 4
FORD 3000 2
SMITH 800 14
SCOTT 3000 2
ADAMS 1100 12
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data. If you use only commonly available tables (such as those in the scott or hr schemas), then you don't have to post any sample data; just post the results.
Explain how you get those results from that data.
Always say what version of oracle you're using. -
Report Designer - Summary page based on 3 queries with dynamic hierarchy?
Dear All,
I am trying to build a workbook based on 3 queries with a summary page that pulls in the query data into one page.
Each query is based on one key figure that is split by profit centre hierarchy.
i.e.
Turnover
-Profit Centre Node A
-Profit Centre Node B
-Profit Centre Node C
> Profit Centre C1
> Profit Centre C2
The user can dril-down into each query at whatever level of the PC Hierarchy they wish.
My issue is trying to structure a dynamic summary page that pulls in all rows from the individual queries regardless of the number of profit centre hierarchies contained in each. i.e. The summary could have 5 PCs for queries 1,2 & 3 in one execution, but then 10 for all queries in another execution.
Question:
Can report designer be used to make a dynamic summary sheet that will capture all rows from the individual query? or would an excel macro summary be the only way of doing this?Hi Ingo,
After much testing and looking into trace etc. we have got this thing to behave as desired. Basically, following two things,
- no reference to CR Dynamic Hierarchy variable on report. There were places where this parameter was being refered and causing grief. We tested with brand new report.
- making sure that on query Cost center restriction is placed in Characteristic Restriction area of Filter tab of query, as oppose to default value area filter tab.
With above in place, the published report in infoview behave as desired, i.e. proper hierarchy structure in cost center prompt and group tree and only desired nodes showing on report.
Thank you for all you pointers
Regards
IMS -
What is the role of PRIOR in hierarchial queries
hi all,
what is the role of prior operator in CONNECT BY Clause of the hierarchial queries, what is the effect when it is used on the right side or left side of the condition ? almost all the queries contains this clause, if it is omitted the child values are not coming. what is the reason. plz explain.
please check the following outputs:
SQL> select ename,sys_connect_by_path(ename,'\') hierarchy from emp start with ename='KING' connect by empno = mgr;
ENAME HIERARCHY
KING \KING
Elapsed: 00:00:00.04
SQL> select ename,sys_connect_by_path(ename,'\') hierarchy from emp start with ename='KING' connect by prior empno = mgr;
ENAME HIERARCHY
KING \KING
JONES \KING\JONES
SCOTT \KING\JONES\SCOTT
ADAMS \KING\JONES\SCOTT\ADAMS
FORD \KING\JONES\FORD
SMITH \KING\JONES\FORD\SMITH
BLAKE \KING\BLAKE
ALLEN \KING\BLAKE\ALLEN
WARD \KING\BLAKE\WARD
MARTIN \KING\BLAKE\MARTIN
TURNER \KING\BLAKE\TURNER
JAMES \KING\BLAKE\JAMES
CLARK \KING\CLARK
MILLER \KING\CLARK\MILLER
14 rows selected.
Elapsed: 00:00:00.09
SQL> select ename,sys_connect_by_path(ename,'\') hierarchy from emp start with ename='KING' connect by empno = prior mgr;
ENAME HIERARCHY
KING \KING
Elapsed: 00:00:00.06
SQL>
thanks and regards,
sri ram.Hi, Sri Ram,
Sri Ram wrote:
hi all,
what is the role of prior operator in CONNECT BY Clause of the hierarchial queries, "PRIOR x" means a value of x from one of the rows that were added to the result set at the previous level.
what is the effect when it is used on the right side or left side of the condition ? There is no difference between
CONNECT BY PRIOR x = yand
CONNECT BY y = PRIOR xjust like there is no difference between
WHERE x = yand
WHERE y = x
almost all the queries contains this clause, No, most queries do not contain a CONNECT BY clause.
Most queries that have a CONNECT BY clause do use a PRIOR operator.
if it is omitted the child values are not coming. what is the reason. plz explain.No, that's not true. A common example is a Counter Table :
SELECT SYSDATE + LEVEL - 1
FROM dual
CONNECT BY LEVEL <= 7;
please check the following outputs:
SQL> select ename,sys_connect_by_path(ename,'\') hierarchy from emp start with ename='KING' connect by empno = mgr;
ENAME HIERARCHY
KING \KING
Elapsed: 00:00:00.04
SQL> select ename,sys_connect_by_path(ename,'\') hierarchy from emp start with ename='KING' connect by prior empno = mgr;
ENAME HIERARCHY
KING \KING
JONES \KING\JONES
SCOTT \KING\JONES\SCOTT
ADAMS \KING\JONES\SCOTT\ADAMS
FORD \KING\JONES\FORD
SMITH \KING\JONES\FORD\SMITH
BLAKE \KING\BLAKE
ALLEN \KING\BLAKE\ALLEN
WARD \KING\BLAKE\WARD
MARTIN \KING\BLAKE\MARTIN
TURNER \KING\BLAKE\TURNER
JAMES \KING\BLAKE\JAMES
CLARK \KING\CLARK
MILLER \KING\CLARK\MILLER
14 rows selected.
Elapsed: 00:00:00.09
SQL> select ename,sys_connect_by_path(ename,'\') hierarchy from emp start with ename='KING' connect by empno = prior mgr;
ENAME HIERARCHY
KING \KINGOkay, I checked them. I get the same results. Did you have a question about them? -
Doubt's regarding the Hierarchial Queries in Oracle
Hi,
i have a doubt regarding the Hierarchial Queries in Oracle.
SELECT * FROM TMP_TEST;
ID NUMVAL STRVAL
1 100 Hello
1 -100 World
2 1 Concatenate
2 2 In String
2 3 using Connect By
2 4 Using SYS_CONNECT_BY_PATH
i am clear with my execution of IN_Line view (mechanism how it work's) .
But i have also read about the Hierarchial queries in the Oracle product documentation's. i am also aware of the
SYS_CONNECT_BY_PATH , LEVEL & START WITH , CONNECT BY Keywords.
But i couldnot able to Manually work out as how this below Query works.
Can you please explain me how this Hieracial query works ?
SELECT ID, (SYS_CONNECT_BY_PATH(STRVAL,',')),LEVEL
FROM
SELECT ID,STRVAL,ROW_NUMBER() OVER(PARTITION BY ID ORDER BY ID) RNUM,
COUNT(*) OVER(PARTITION BY ID ORDER BY ID) CNT,NUMVAL
FROM TMP_TEST
START WITH RNUM = 1
CONNECT BY PRIOR RNUM = RNUM - 1
Many Thanks,
Rajesh.Hi, Rajesh,
My first message was in response to your first message.
In your latest message, the query is:
SELECT ID, (SYS_CONNECT_BY_PATH(STRVAL,',')),LEVEL
FROM (
SELECT ID,STRVAL,ROW_NUMBER() OVER(PARTITION BY ID ORDER BY ID) RNUM,
COUNT(*) OVER(PARTITION BY ID ORDER BY ID) CNT,NUMVAL
FROM TMP_TEST
WHERE RNUM = CNT
START WITH RNUM = 1
CONNECT BY PRIOR RNUM = RNUM - 1;It looks like you lost the second CONNECT BY condition:
AND PRIOR ID = IDPut it back: it's important.
Now you're confused about the output row:
2 ,Hello,World,using Connect By,Using SYS_CONNECT_BY_PATH 4It doesn't seem to correspond to anything results that you got when you ran the sub-query alone.
That's because the resutls from your sub-query may change every time you run it, even though the data doesn't change. The ORDER BY clauses in both of the analytic functions do not result in a complete ordering. In fact, they're completely meaningless. It never makes any sense to PARTITON BY and ORDER BY the same value; "PARTITION BY id" means that only rows with the same id will be compared to each other; you might as well say "ORDER BY 0" or "ORDER BY dmbs_random.value".
The ORDER BY clause of ROW_NUMBER whould reflect that way in which you want the results to appear within each id, for example:
ROW_NUMBER () OVER (PARTITION BY id ORDER BY UPPER (strval))Note that this is very similar to what was in my first reply.
In the COUNT function, why do you want an ORDER BY clause at all? Just say:
COUNT (*) OVER (PARTITION BY id) -
How to find the queries based on the hierarchy
Hi experts,
Many queries are using one hierarchy.now I want to know which queries are using this hierarchy. How to make it? Thank you.
Best regards,
GavinUnder this object check where used list. Then you should get the list of queries where this hierarchy is used.
Regards
Rohini -
Finding hierarchy use in queries
Hi BWExperts,
We have Four Hiearchies on one Infoobject and the Infoobject is using several Queries.The requirement is, we would like to know which hiearchy is using in which query.Please advice is there any program or backend table exists for this.
Thanks in advance.
Regards,
PreethamHello,
Have a look at this
Identifying where a hierarchy is used
Also
https://wiki.sdn.sap.com/wiki/display/BI/ImportantTablesinSAPBI%28NW2004%29
https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=35458&focusedCommentId=45993#comment-45993 -
List of queries where in a hierarchy being used.
Hi -
Could anyone please tell me how to find out list of queries where in a particular hierarchy is being used.
Not the queries where a infoobject is used.
I want the list of queries where a hierarchy is being used.
Thanks for the help
Praveen TatiHi
Go to the Hierarchies Table and say where Used list
SE16
CGPL_HIERARCHY
COMC_HIERARCHY
COMM_HIERARCHY
COMM_HIERARCHYH
COMM_HIERARCHYT
COMM_HIERARCHYTH
COMM_HIERARCHYWL
HIERARCHY_ENTRY
RSROLEHIERARCHY
UPB_SY_HIERARCHY
UPB_YT_HIERARCHY
UPS_TP_HIERARCHY
UPWB_HIERARCHY
USS_BW_HIERARCHY
BIC/H -- Heirarchy Table
/BIC/K -- Heirarchy SID Table
RXSELTXREF, RSCOMPDIR -- Reports/query relavent tables
You can even go and see the Table RSRRREPDIR -- For the Directory of Reports
Hope it helps -
Urgent! Hierarchy Nodes Missing in Queries
Hi,
For cost center hierarchy, some nodes r missing in the Query. I checked in the cost center hierarchy tab page. i could see all the nodes in 0Costcenter and as well as in source system. How can i get all the hierarchies nodes. what exactly the problem. why some nodes r missing.
please respond me immediately if any body faced with same kind of problem.
Nagesh.
Message was edited by: Nagesh Ganisetti
Message was edited by: Nagesh Ganisetticould u please confirm any body... Hierarchy node will be displayed only when relevant Transactional data si available?
for my costcenter hierarchy, Somes nodes r missing.
plz guide me.
Nagesh
Message was edited by: Nagesh Ganisetti -
Time-Depended hierarchy and BEx-Queries
Hi Gurus, Masters,
I have ONE time-depended hierarchy for 4 periods (times):
1, 2, 3, 4
I have 4 columns in Query with 4 periods:
1 col for 1 period,
2 col for 2 period,
3 col for 3 period,
4 col for 4 period.
I have 1 row with this hierarchy.
How can i share this hierarchy in my columns by validity:
for 1 col -> this hierarchy for 1 period,
for 2 col -> this hierarchy for 2 period,
for 3 col -> this hierarchy for 3 period,
for 4 col -> this hierarchy for 4 period?
Any answer will be very appreciated.
Thank you.
Is this possible?
P.S.
I have 2 solutions found.
Message was edited by: AndyMLHi Shashi,
One of the ways:
Create a variable type customer exit - in properties of the IO - in the 'select hierarchy' window there is a 'Variables' checkbox for key date.
Calculate the last date of the entered period/year in the exit.
Best regards,
Eugene -
Please answer the below queries on urgent manner
Scenario 1. SCCM installed as a primary stand alone site, It is possible to install/configure another primary site in same site code.
I understand existing stand alone should connected to CAS server first, Under the CAS server can i install another Primary site in remote locations - ??
Scenarion 2. Assume i installed CAS server first, created the primary(1st) in Headoffice and plannned to install another primary (2nd) site in remote location. Any replication will happen be between CAS server and primary site (2nd) installed in
remote locations. If Yes, can it scheduled at off time or it can enabled with Branch cache. -??If I continue with my stand alone primary site, is it possible to extend another primary site under existing primary site server
without introducing CAS server ??<o:p></o:p>
Rajesh – No, it is not possible,<o:p></o:p>
If its allowed to introduce another primary site under existing stand alone primary site, Whether the new primary
site can handle clients independently (No client should contact parent primary site) ??<o:p></o:p>
Rajesh :: This scenario is not possible. <o:p></o:p>
If i planned to introduce secondary site under existing stand alone primary site, Separate CAS server still
required ??.<o:p></o:p>
Rajesh :: No it is not required. You can install a secondary Site under the primary site without the CAS.<o:p></o:p>
If i add an secondary site under exisitng primary site server, i assumed secondary site server data's (client
info) will always replicate to primary site - this will choke my network traffic -??<o:p></o:p>
Rajesh :: Secondary Site will always replicate the data to Primary Site. Bandwidth utilization depends on the number of clients
on the secondary site. If you have less than 2000 clients and have a good network link, you can still survive with a DP only.<o:p></o:p>
Assume, I installed CAS server, Under CAS server two primary server (1 - HO site, 1 - Branch site) added.
In that case i need clarity, whether branch primary site will replicate continously with CAS server for data replication ??<o:p></o:p>
Rajesh :: Yes, There will be a continuous data replication between CAS and Primary site. In addition to that content and un
processed DDRs will flow using file base replication. However you can configure bandwidth throttling using replication routes to control file base replication. Please visit following link to understand data replication in SCCM 2012.
http://blogs.technet.com/b/server-cloud/archive/2012/03/06/data-replication-in-system-center-2012-configuration-manager.aspx
Maybe you are looking for
-
After updating to FCPX 10.1.1 my shape mask starts waaaay off screen. Too far for me even to grab the center fully zoomed out. My friends mac had the same problem after the update. Anyone have an idea on what to do? Thanks
-
Iphoto has not loaded since about 44 unwanted photos were sent to trash from the library file in pictures. I have since read the piece on tamper. But can anyone tell me if and how I can fix this? The files are still in 'trash'. Cheers.
-
I have an 881 router configured with 2 dhcp WAN connections. I am trying to configure failure detection of the primary connection (I do not really care about the secondary at this time). I have an ip sla/track configured to monitor the primary WAN c
-
Jump to BP transaction from bex query
Hello all, the client I´m working for wants to jump from a bex query to BP crm transaction. I implemented that using RSBBS transaction, but when I execute the query --> Right mouse click --> Go to --> transaction (BP) system goes to a web page; The i
-
A friend suggested this: What if users could upload vector images, and preview how those images would look sporting various selected color themes? In other words, you might upload a logo ... or a mockup of apparrel ... or a vector mockup of a website