Restriciting BI query for Hierarchy authorization for a defined group
Hi Friends
We are trying to restrict the Display with respect to the company codes group.
We have defined the authoirzation for BI w.r.t to the company code and groups ( collection of co.codes ) ..We have defined the authoirzation object under Rsecadmin and restricted the display for only group eg: GH3 . However when we ran the query we can see all the companies / groups. Also tried with putting the GHR group under Hierarchy authorization but still have the same result.
Can you please let me know what is going wrong
thank for all your help..
We have defined the authoirzation for BI w.r.t to the company code and groups ( collection of co.codes ) ..We have defined the authoirzation object under Rsecadmin and restricted the display for only group eg: GH3 .
Did you check if the infoprovider(s) which your query is hitting upon has company code and company groups checked as authorization relevant in RSA1?
Thanks
Sandipan
Similar Messages
-
SAP query for Material pricing group changes in material.
Dear all,
I'm trying to generate a query for Material Pricing group changes in material. For that I've to retrieve data from follwing three tables MVKE, CDHDR & CDPOS.
Firstly while generating infoset -
I tried it by joining tables MVKE & CDHDR, but system is not allowing it, also table CDPOS can't bejoined.
Then I tried by reading dirctly from table MVKE and then adding additional fields in it. query created using this infoset is giving the output, however it's giving only 1 entry per material entered in input.
for multiple entries in output for MPG changes in same material I tried creating addtional structure for table CDHDR & CDPOS but again I'm getting only 1 entry per material.
please suggest how I can get MPG changes done in specified time period for a material.
Thanks.Hi
Check the report RSSCD100 and run it for object MAT_FULL for table MVKE. Use this report as a template for your own development.
I hope this helps you
Regards
Eduardo
PD: sorry, the table is DMVKE
Edited by: E_Hinojosa on Sep 2, 2011 9:37 AM -
Query for PO total group by Supplier
Hi All,
Does any 1 have query which gives the total of PO's for a supplier? and that to top 10 suppliers?
For example there are 100 PO's for Supplier 'A'.
I need total of al 100 PO's for Supplier 'A'.
Also is there iny report which gives for top 10 suppliers.
Thanks in Advance,
SYRHere are some pointers so you can write your own query.
Start with po_vendors to get vendor_id for your vendor.
Join with po_headers_all to get po's for that vendor. Focus on standard pos only.
Join with po_lines_all to get price and quantity for those po.
Sum up the price*quantity to get total.
Do you have blanket Purchase orders? If yes, then you will have to include po_releases_all.
Hope this helps,
Sandeep Gandhi -
SQL Query for user defined form
Hi experts,
I want query to update some fields in my user defined form using stored procedure on clicking of ADD button.
Explanation:
I have User Defined form call "DC request" with Object 'DCLM'..On click of Add button, it is saving my record info into the form. But in one field if value in not entered then it is saving as 'Null'.
Addon is already made, can not change in coding.
I want to update this field with '0' value through query in stored procedure on click of Add Button. Can anyone help me out to achieve this.
ThanksHi Team Bone.
Please try below Transaction Notification which will Restrict User to ADD if Field_Name is NULL and then User Need to Enter ZERO i.e. 0 for Adding.
IF @OBJECT_TYPE = 'DCLM' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U')
BEGIN
If Exists (Select T0.DocEntry from [Table_Name] T0 Where ( T0.Field_Name is null OR T0.Field_Name = ' ' ) AND T0.DocEntry = @lisT_of_cols_val_Tab_del )
begin
SET @error = -100000
SET @error_message = 'Filed_Name is NULL then So, Please enter ZERO Value i.e. 0 in Filed_Name'
End
End
Please change Table_Name and Field_Name with with UDO field.
Hope this help
Regards::::
Atul Chakraborty -
SCCM 2007 database query for AD security group for machines
dear,
I am had created security DL in AD for machine to deploy software and trying to link in SCCM 2007 with collection but could not
i have tried query base following below link but its does not help
http://www.windows-noob.com/forums/index.php?/topic/892-deploy-software-through-ad-groups-linked-to-collections-in-sccm/
type all query but could not find in table (SystemGroupName).
[email protected]Go to properties of you collection and add a new membership rule to add the security group
SCCM use discovery methods to get information from AD. Make sure AD system discovery and AD security group discovery are enabled for the SCCM site. Once you add machines to the security group, you need to wait till the next discovery cycle is completed.
The discovery cycle runs on a schedule set by SCCM administrator. -
There are no queries in the log for selected measure group
I configured SSAS 2008 R2 Server to dump every 5th query to olapquerlog table in a new logging database. Data is coming to the log table fine. I have been running it from last two weeks. I have about 175 queries against the cube which i
want to aggregate. When i run the usage based aggregation wizard, ssas never finds any query for all measure group. i see a warning below that, "There are no queries in the log for selected measure group".
Can anyone tell me why?
Aneel IsmailyID and Database Name look same when i open code from cube;
<ID>Spend
Analytics DW</ID>
<Name>Spend
Analytics DW</Name>
this is how data looks like in sql table;
MSOLAP_Database
MSOLAP_ObjectPath
MSOLAP_User
StartTime
Duration
1
SpendAnalyticsDW
NT1101112\BICORP.SpendAnalytics.Spend Analytics DW.Account Ledger
ROCKTENN\!sharepoint2010
6/22/2011
718
2
SpendAnalyticsDW
NT1101112\BICORP.SpendAnalytics.Spend Analytics DW.Account Payable 1
ROCKTENN\SDouglas
6/20/2011
359
Note: I have removed actual dataset from the table, because of its length.Aneel Ismaily -
Need to write SQL query for hierarchy
Hi Guys,
I need help to write a query for the below scenario.
I have one organization, under that I have many branches. when i provide input to query on last branch, i need to display all parents of that branch like below
Organization ---parent
branch 1 ---child
branch11
branch 12
branch 2 ---child
branch 21
branch 3 ----child
branch 31
branch 32
branch 33
here, when i provide input as branch 3, then I need to fetch results branch 2, branch 1 till organization.
can any one help me on this.
Thanks in advance!
Regards,
LKRHi,
Is this the same question as
https://community.oracle.com/thread/2616828
Please don't post the same question over and over. Mark this thread as "Answered" right away, and continue in the other thread (if necessary; the other thread has answers.) -
Question/issue regarding querying for uncommited objects in Toplink...
Hi, was hoping to get some insight into this problem we are encoutering
We have this scenario were we are creating a folder hierarchy (using Toplink)
1. a parent folder is created
2. child elements are created (in the same transaction as step 1),
3. we need to lookup the parent folder and assign it as the parent
of these child elements
4. end the transaction and commit all data
In our system we control access to objects by appending a filter to the selection criteria, so we end up with SQL like this example
(The t2 stuff is the authorization lookup part of the query.) ;
SELECT t0.ID, t0.CLASS_NAME, t0.DESCRIPTION, t0.EDITABLE,
t0.DATE_MODIFIED, t0.DATE_CREATED,
t0.MODIFIED_BY, t0.ACL_ID, t0.NAME, t0.CREATED_BY,
t0.TYPE_ID, t0.WKSP_ID, t1.ID, t1.LINK_SRC_PATH,
t1.ABSOLUTE_PATH, t1.MIME_TYPE, t1.FSIZE,
t1.CONTENT_PATH, t1.PARENT_ID
FROM XDOOBJECT t0, ALL_OBJECT_PRIVILEGES t2,
ARCHIVEOBJECT t1
WHERE ((((t1.ABSOLUTE_PATH = '/favorites/twatson2')
AND ((t1.ID = t2.xdoobject_id)
AND ((t2.user_id = 'twatson2')
AND (bitand(t2.privilege, 2) = 2))))
AND (t1.ID = t0.ID))
AND (t0.CLASS_NAME = 'oracle.xdo.server.repository.model.Archivable'))
When creating new objects we also create the authorization lookup record (which is inserted into a different table.) I can see all the objects are registered in the UOW identity map.
Basically, the issue is that this scenario all occurs in a single transaction and when querying for the newly created parent folder, if the authorization filter is appended to the query, the parent is not found. If I remove the authorization filter then the parent is found correctly. Or if I break this up into separate transactions and commit after each insert, then the parent is found correctly.
I use the conformResultsInUnitOfWork attribute on the queries.
This is related to an earlier thread I have in this discussion forum;
Nested UnitOfWork and reading newly created objects...
Thanks for any help you can provide,
-TimHi Doug, we add the authorization filter directly in the application code as the query is getting set up.
Here are some code examples; 1) the first is the code to create new object in the system, followed by 2) the code to create a new authorization lookup record (which also uses the first code to do the actual Toplink insert), then 3) an example of a read query where the authorization filter is appended to the Expression and after that 4) several helper methods.
I hope this is of some use as it's difficult to show the complete flow in a simple example.
1)
// create new object example
public Object DataAccess.createObject(....
Object result = null;
boolean inTx = true;
UnitOfWork uow = null;
try
SessionContext sc = mScm.getCurrentSessionContext();
uow = TLTransactionManager.getActiveTransaction(sc.getUserId());
if (uow == null)
Session session = TLSessionFactory.getSession();
uow = session.acquireUnitOfWork();
inTx = false;
Object oclone = (Object) uow.registerObject(object);
uow.assignSequenceNumbers();
if (oclone instanceof BaseObject)
BaseObject boclone = (BaseObject)oclone;
Date now = new Date();
boclone.setCreated(now);
boclone.setModified(now);
boclone.setModifiedBy(sc.getUserId());
boclone.setCreatedBy(sc.getUserId());
uow.printRegisteredObjects();
uow.validateObjectSpace();
if (inTx == false) uow.commit();
//just temp, see above
if (true == authorizer.requiresCheck(oclone))
authorizer.grantPrivilege(oclone);
result = oclone;
2)
// Authorizer.grantPrivilege method
public void grantPrivilege(Object object) throws DataAccessException
if (requiresCheck(object) == false)
throw new DataAccessException(
"Object does not implement Securable interface.");
Securable so = (Securable)object;
ModulePrivilege[] privs = so.getDefinedPrivileges();
BigInteger pmask = new BigInteger("0");
for (int i = 0; i < privs.length; i++)
BigInteger pv = PrivilegeManagerFactory.getPrivilegeValue(privs);
pmask = pmask.add(pv);
SessionContext sc = mScm.getCurrentSessionContext();
// the authorization lookup record
ObjectUserPrivilege oup = new ObjectUserPrivilege();
oup.setAclId(so.getAclId());
oup.setPrivileges(pmask);
oup.setUserId(sc.getUserId());
oup.setXdoObjectId(so.getId());
try
// this recurses back to the code snippet from above
mDataAccess.createObject(oup, this);
catch (DataAccessException dae) {
Object[] args = {dae.getClass().toString(), dae.getMessage()};
logger.severe(MessageFormat.format(EXCEPTION_MESSAGE, args));
throw new DataAccessException("Failed to grant object privilege.", dae);
3)
// example Query code
Object object = null;
ExpressionBuilder eb = new ExpressionBuilder();
Expression exp = eb.get(queryKeys[0]).equal(keyValues[0]);
for (int i = 1; i < queryKeys.length; i++)
exp = exp.and(eb.get(queryKeys[i]).equal(keyValues[i]));
// check if need to add authorization filter
if (authorizer.requiresCheck(domainClass) == true)
// this is where the authorization filter is appended to query
exp = exp.and(appendReadFilter());
ReadObjectQuery query = new ReadObjectQuery(domainClass, exp);
SessionContext sc = mScm.getCurrentSessionContext();
if (TLTransactionManager.isInTransaction(sc.getUserId()))
// part of a larger transaction scenario
query.conformResultsInUnitOfWork();
else
// not part of a transaction
query.refreshIdentityMapResult();
query.cascadePrivateParts();
Session session = getSession();
object = session.executeQuery(query);
4)
// builds the authorzation filter
private Expression appendReadFilter()
ExpressionBuilder eb = new ExpressionBuilder();
Expression exp1 = eb.getTable("ALL_OBJECT_PRIVILEGES").getField("xdoobject_id");
Expression exp2 = eb.getTable("ALL_OBJECT_PRIVILEGES").getField("user_id");
Expression exp3 = eb.getTable("ALL_OBJECT_PRIVILEGES").getField("privilege");
Vector args = new Vector();
args.add(READ_PRIVILEGE_VALUE);
Expression exp4 =
exp3.getFunctionWithArguments("bitand",args).equal(READ_PRIVILEGE_VALUE);
SessionContext sc = mScm.getCurrentSessionContext();
return eb.get("ID").equal(exp1).and(exp2.equal(sc.getUserId()).and(exp4));
// helper to get Toplink Session
private Session getSession() throws DataAccessException
SessionContext sc = mScm.getCurrentSessionContext();
Session session = TLTransactionManager.getActiveTransaction(sc.getUserId());
if (session == null)
session = TLSessionFactory.getSession();
return session;
// method of TLTransactionManager, provides easy access to TLSession
// which handles Toplink Sessions and is a singleton
public static UnitOfWork getActiveTransaction(String userId)
throws DataAccessException
TLSession tls = TLSession.getInstance();
return tls.getTransaction(userId);
// the TLSession method, returns the active transaction (UOW)
// or null if none
public UnitOfWork getTransaction(String uid) {
UnitOfWork uow = null;
UowWrapper uw = (UowWrapper)mTransactions.get(uid);
if (uw != null) {
uow = uw.getUow();
return uow;
Thanks!
-Tim -
Error while executing a sql query for select
HI All,
ORA-01652: unable to extend temp segment by 128 in tablespace PSTEMP i'm getting this error while i'm executing the sql query for selecting the data.I am having 44GB of temp space, while executing the below query my temp space is getting full, Expert please let us know how the issue can be resolved..
1. I dont want to increase the temp space
2. I need to tune the query, please provide your recomendations.
insert /*+APPEND*/ into CST_DSA.HIERARCHY_MISMATCHES
(REPORT_NUM,REPORT_TYPE,REPORT_DESC,GAP,CARRIED_ITEMS,CARRIED_ITEM_TYPE,NO_OF_ROUTE_OF_CARRIED_ITEM,CARRIED_ITEM_ROUTE_NO,CARRIER_ITEMS,CARRIER_ITEM_TYPE,CARRIED_ITEM_PROTECTION_TYPE,SOURCE_SYSTEM)
select
REPORTNUMBER,REPORTTYPE,REPORTDESCRIPTION ,NULL,
carried_items,carried_item_type,no_of_route_of_carried_item,carried_item_route_no,carrier_items,
carrier_item_type,carried_item_protection_type,'PACS'
from
(select distinct
c.REPORTNUMBER,c.REPORTTYPE,c.REPORTDESCRIPTION ,NULL,
a.carried_items,a.carried_item_type,a.no_of_route_of_carried_item,a.carried_item_route_no,a.carrier_items,
a.carrier_item_type,a.carried_item_protection_type,'PACS'
from CST_ASIR.HIERARCHY_asir a,CST_DSA.M_PB_CIRCUIT_ROUTING b ,CST_DSA.REPORT_METADATA c
where a.carrier_item_type in('Connection') and a.carried_item_type in('Service')
AND a.carrier_items=b.mux
and c.REPORTNUMBER=(case
when a.carrier_item_type in ('ServicePackage','Service','Connection') then 10
else 20
end)
and a.carrier_items not in (select carried_items from CST_ASIR.HIERARCHY_asir where carried_item_type in('Connection') ))A
where not exists
(select *
from CST_DSA.HIERARCHY_MISMATCHES B where
A.REPORTNUMBER=B.REPORT_NUM and
A.REPORTTYPE=B.REPORT_TYPE and
A.REPORTDESCRIPTION=B.REPORT_DESC and
A.CARRIED_ITEMS=B.CARRIED_ITEMS and
A.CARRIED_ITEM_TYPE=B.CARRIED_ITEM_TYPE and
A.NO_OF_ROUTE_OF_CARRIED_ITEM=B.NO_OF_ROUTE_OF_CARRIED_ITEM and
A.CARRIED_ITEM_ROUTE_NO=B.CARRIED_ITEM_ROUTE_NO and
A.CARRIER_ITEMS=B.CARRIER_ITEMS and
A.CARRIER_ITEM_TYPE=B.CARRIER_ITEM_TYPE and
A.CARRIED_ITEM_PROTECTION_TYPE=B.CARRIED_ITEM_PROTECTION_TYPE
AND B.SOURCE_SYSTEM='PACS'
Explain Plan
==========
Plan
INSERT STATEMENT ALL_ROWSCost: 129 Bytes: 1,103 Cardinality: 1
20 LOAD AS SELECT CST_DSA.HIERARCHY_MISMATCHES
19 PX COORDINATOR
18 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10002 :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1
17 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1
15 HASH JOIN RIGHT ANTI NA PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,098 Cardinality: 1
4 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 63 Bytes: 359,283 Cardinality: 15,621
3 PX SEND BROADCAST PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621
2 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621
1 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621
14 NESTED LOOPS ANTI PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 40,256,600 Cardinality: 37,448
11 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 6,366,160 Cardinality: 37,448
8 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1002
7 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 1 Bytes: 214 Cardinality: 2
6 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 1 Bytes: 214 Cardinality: 2
5 INDEX FULL SCAN INDEX CST_DSA.IDX$$_06EF0005 Cost: 1 Bytes: 214 Cardinality: 2
10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448
9 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448
13 TABLE ACCESS BY INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT CST_DSA.HIERARCHY_MISMATCHES :Q1002Cost: 0 Bytes: 905 Cardinality: 1
12 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT SYS.HIERARCHY_MISMATCHES_IDX3 :Q1002Cost: 0 Cardinality: 1
16 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT CST_DSA.IDX$$_06EF0001 :Q1002Cost: 1 Bytes: 5 Cardinality: 1 -
MDX query for parent-child combination display
Hi guys..
I am really new to the Essbase technology.
Could you please help me out with this one:
is it possible to extract the data(for example the metadata of a outline)..eg:-
The outline structure is as follows :
A1
A11
A12
A2
A21
A22
I want a MDX query to display it as :
A1 A11
A1 A12
A2 A21
A2 A22
I have tried various ways but couldnt come up with a query for this.
Thanks in advance for all your help.Unfortunately MDX cannot do this. If you think about what you are asking for, you are essentially saying that you want to see members of the same dimension on different axis. Multi-dimensional queries can't do that (think about trying to do it with addin).
A further limiation is that MDX is not robust enough to allow you to work the results into a single axis using a concatenation function because while there is a string-to-member function, there is no member-to-string function and concat requires a string as input.
Other approaches would require MDX to support joins or subqueries, which it does not.
As others have mentioned, to do what you want to do, you need outline extractor or something like that.
*Fun fact - if you have OBIEE 11g, it can do reporting in Essbase with hierarchy members in hierarchy format or column format, which will give you the results you need. That alone is good reason to start using OBIEE. -
Why authorization for cost center groups does not worked ?
hello all,
I would like to give authorization for a CO report (S_ALR_87013625) based on authorization values : cost center groups.
But, unfortunately, it doesn't work. I get a message : No authorization for x of x read records.
Is it only possible to give authorization on standard hierarchy and cost center ?
Please, help me
Thanks and best regardshi,
Run the su53 transaction.See what authorization was missing -
Hierarchical + Analytical query for organizational unit parameters
Hello gurus,
I try for a couples of hour ago to make a query work as I would like.
Our application need to store some parameters for our organization units. These organization units are typically organized in in an hierarchy manner: one top unit with many level of child units. The parameters are stored into another table with 1:1 relationship.
For sake of visualisation, here is the data for the organization unit and parameter table in a more visual format:
SQL> select * from organization_unit;
UNIT_CODE UNIT_NAME PARENT_UNIT_CODE
00000 Top level
10 L2 unit #10 00000
10-01 L3 unit #10-01 10
10-02 L3 unit #10-02 10
20 L2 unit #20 00000
20-01 L3 unit #20-01 20
20-02 L3 unit #20-02 20
SQL> select * from org_unit_parameters;
UNIT_CODE PARAM1 PARAM2 PARAM3 PARAM4
00000 Default value Default value Default value {null}
10 {null} Value from 10 Value from 10 {null}
10-01 {null} {null} Value from 10-01 {null}
10-02 {null} {null} {null} Value from 10-02
20 Value from 20 Value from 20 Value from 20 {null}
20-01 {null} Value from 20-01 {null} {null}
20-02 {null} Value from 20-02 {null} {null}The application will query the parameter table to get a parameter value for a given unit.
The parameter resolution algorithm is rather simple: when querying a unit, the applicable parameter is the one defined at the requested level. If the parameter is not defined (null) at the requested level, the parameter value that must be returned is the next defined one in the parent hierarchy. In some rare cases, it can be null if a parameter is not defined anywhere from the requested level to top.
I've made a query that seems to work when querying for one unit at a time. It use hierarchical operators (start with + connect by) with a bit of analytical functions. Here is a test & raw output example:
SQL> WITH hierarchy
2 AS
3 (
4 SELECT ou.unit_code,
5 LEVEL AS lvl
6 FROM organization_unit ou
7 START WITH
8 ou.unit_code = '20-01'
9 CONNECT BY
10 ou.unit_code = PRIOR ou.parent_unit_code
11 )
12 SELECT h.*,
13 p.param1 AS param1_raw,
14 LAST_VALUE (p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param1_with_last,
15 FIRST_VALUE(p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param1_with_first,
16 p.param2 AS param2_raw,
17 LAST_VALUE (p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param2_with_last,
18 FIRST_VALUE(p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param2_with_first,
19 p.param3 AS param3_raw,
20 LAST_VALUE (p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param3_with_last,
21 FIRST_VALUE(p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param3_with_first,
22 p.param4 AS param4_raw,
23 LAST_VALUE (p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param4_with_last,
24 FIRST_VALUE(p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param4_with_first
25 FROM hierarchy h
26 LEFT JOIN org_unit_parameters p
27 ON h.unit_code = p.unit_code
28 ORDER BY h.lvl DESC;
UNIT_CODE LVL PARAM1_RAW PARAM1_WITH_LAST PARAM1_WITH_FIRST PARAM2_RAW PARAM2_WITH_LAST PARAM2_WITH_FIRST PARAM3_RAW PARAM3_WITH_LAST PARAM3_WITH_FIRST PARAM4_RAW PARAM4_WITH_LAST PARAM4_WITH_FIRST
00000 3 Default value Default value Value from 20 Default value Default value Value from 20-01 Default value Default value Value from 20 {null} {null} {null}
20 2 Value from 20 Value from 20 Value from 20 Value from 20 Value from 20 Value from 20-01 Value from 20 Value from 20 Value from 20 {null} {null} {null}
20-01 1 {null} Value from 20 {null} Value from 20-01 Value from 20-01 Value from 20-01 {null} Value from 20 {null} {null} {null} {null}Seems pretty good, the upper parameters are well «propagated» down with LAST_VALUE function. But, I don't understand why the use of FIRST_VALUE and oppposite ordering doesn't give the same result. A little more playing with the last query for getting the final result for a given unit code:
SQL> SELECT *
2 FROM
3 (
4 WITH hierarchy
5 AS
6 (
7 SELECT ou.unit_code,
8 LEVEL AS lvl
9 FROM organization_unit ou
10 START WITH
11 ou.unit_code = '20-01'
12 CONNECT BY
13 ou.unit_code = PRIOR ou.parent_unit_code
14 )
15 SELECT h.*,
16 LAST_VALUE (p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param1,
17 LAST_VALUE (p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param2,
18 LAST_VALUE (p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param3,
19 LAST_VALUE (p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param4
20 FROM hierarchy h
21 LEFT JOIN org_unit_parameters p
22 ON h.unit_code = p.unit_code
23 ORDER BY h.lvl
24 )
25 WHERE ROWNUM = 1;
UNIT_CODE LVL PARAM1 PARAM2 PARAM3 PARAM4
20-01 1 Value from 20 Value from 20-01 Value from 20 {null}Works well!
But, my ultimate goal is to create a view that resolve correctly all these parameters for each level of the organization with proper propagation rather then querying for each unit at a time. I played a bit, but without success. :( My current raw query is this one:
SQL> WITH hierarchy
2 AS
3 (
4 SELECT ou.unit_code,
5 LPAD(' ',2*(LEVEL-1)) || ou.unit_code AS tree,
6 LEVEL AS lvl
7 FROM organization_unit ou
8 START WITH
9 parent_unit_code IS NULL
10 CONNECT BY
11 PRIOR unit_code = parent_unit_code
12 )
13 SELECT h.*,
14 p.param1 AS param1_raw,
15 LAST_VALUE (p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param1_with_last,
16 FIRST_VALUE(p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param1_with_first,
17 p.param2 AS param2_raw,
18 LAST_VALUE (p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param2_with_last,
19 FIRST_VALUE(p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param2_with_first,
20 p.param3 AS param3_raw,
21 LAST_VALUE (p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param3_with_last,
22 FIRST_VALUE(p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param3_with_first,
23 p.param4 AS param4_raw,
24 LAST_VALUE (p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param4_with_last,
25 FIRST_VALUE(p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param4_with_first
26 FROM hierarchy h
27 LEFT JOIN org_unit_parameters p
28 ON h.unit_code = p.unit_code
29 ORDER BY h.unit_code;
UNIT_CODE TREE LVL PARAM1_RAW PARAM1_WITH_LAST PARAM1_WITH_FIRST PARAM2_RAW PARAM2_WITH_LAST PARAM2_WITH_FIRST PARAM3_RAW PARAM3_WITH_LAST PARAM3_WITH_FIRST PARAM4_RAW PARAM4_WITH_LAST PARAM4_WITH_FIRST
00000 00000 1 Default value Default value Default value Default value Default value Default value Default value Default value Default value {null} Value from 10-02 {null}
10 10 2 {null} Value from 20 Default value Value from 10 Value from 10 Default value Value from 10 Value from 10 Default value {null} Value from 10-02 {null}
10-01 10-01 3 {null} {null} Default value {null} Value from 20-02 Default value Value from 10-01 Value from 10-01 Default value {null} Value from 10-02 Value from 10-02
10-02 10-02 3 {null} {null} Default value {null} Value from 20-02 Default value {null} Value from 10-01 Default value Value from 10-02 Value from 10-02 Value from 10-02
20 20 2 Value from 20 Value from 20 Default value Value from 20 Value from 10 Default value Value from 20 Value from 10 Default value {null} Value from 10-02 {null}
20-01 20-01 3 {null} {null} Default value Value from 20-01 Value from 20-02 Default value {null} Value from 10-01 Default value {null} Value from 10-02 Value from 10-02
20-02 20-02 3 {null} {null} Default value Value from 20-02 Value from 20-02 Default value {null} Value from 10-01 Default value {null} Value from 10-02 Value from 10-02As you can see, it's not as I expected. I know there's something to do with a PARTITION BY clause, but don't know how.
Is anyone knows how to solve my problem?
Thanks
Bruno
For reproductibility purposes, here is the code to create sturcture and data:
Here is the format of my tables and some samble data:
CREATE TABLE organization_unit (
unit_code VARCHAR2(5 CHAR) NOT NULL PRIMARY KEY,
unit_name VARCHAR2(100 CHAR) NOT NULL,
parent_unit_code VARCHAR2(5 CHAR)
CREATE TABLE org_unit_parameters (
unit_code VARCHAR2(5 CHAR) NOT NULL PRIMARY KEY,
param1 VARCHAR2(100 CHAR),
param2 VARCHAR2(100 CHAR),
param3 VARCHAR2(100 CHAR),
param4 VARCHAR2(100 CHAR)
-- Inserting data
INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code)
VALUES ('00000', 'Top level', NULL);
INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code)
VALUES ('10', 'L2 unit #10', '00000');
INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code)
VALUES ('10-01', 'L3 unit #10-01', '10');
INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code)
VALUES ('10-02', 'L3 unit #10-02', '10');
INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code)
VALUES ('20', 'L2 unit #20', '00000');
INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code)
VALUES ('20-01', 'L3 unit #20-01', '20');
INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code)
VALUES ('20-02', 'L3 unit #20-02', '20');
INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param1, param2, param3)
VALUES ('00000', 'Default value', 'Default value', 'Default value');
INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param2, param3)
VALUES ('10', 'Value from 10', 'Value from 10');
INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param3)
VALUES ('10-01', 'Value from 10-01');
INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param4)
VALUES ('10-02', 'Value from 10-02');
INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param1, param2, param3)
VALUES ('20', 'Value from 20', 'Value from 20', 'Value from 20');
INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param2)
VALUES ('20-01', 'Value from 20-01');
INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param2)
VALUES ('20-02', 'Value from 20-02');
COMMIT;Now, I hoppe I got your reqs:
WITH hierarchy AS (
SELECT ou.unit_code,
LPAD(' ',2*(LEVEL-1)) || ou.unit_code AS tree,
LEVEL AS lvl,
param1 AS param1_raw,
param2 AS param2_raw,
param3 AS param3_raw,
param4 AS param4_raw,
SYS_CONNECT_BY_PATH(p.param1,'#') || '#' AS param1_path,
SYS_CONNECT_BY_PATH(p.param2,'#') || '#' AS param2_path,
SYS_CONNECT_BY_PATH(p.param3,'#') || '#' AS param3_path,
SYS_CONNECT_BY_PATH(p.param4,'#') || '#' AS param4_path
FROM organization_unit ou LEFT JOIN org_unit_parameters p
ON ou.unit_code = p.unit_code
START WITH parent_unit_code IS NULL
CONNECT BY PRIOR ou.unit_code = parent_unit_code
SELECT unit_code,
tree,
lvl,
param1_raw,
REGEXP_SUBSTR(param1_path,'[^#]+',1,GREATEST(1,REGEXP_COUNT(param1_path,'[^#]+'))) AS param1_with_last,
REGEXP_SUBSTR(param1_path,'[^#]+') AS param1_with_first,
param2_raw,
REGEXP_SUBSTR(param2_path,'[^#]+',1,GREATEST(1,REGEXP_COUNT(param2_path,'[^#]+'))) AS param2_with_last,
REGEXP_SUBSTR(param2_path,'[^#]+') AS param2_with_first,
param3_raw,
REGEXP_SUBSTR(param3_path,'[^#]+',1,GREATEST(1,REGEXP_COUNT(param3_path,'[^#]+'))) AS param3_with_last,
REGEXP_SUBSTR(param3_path,'[^#]+') AS param3_with_first,
param4_raw,
REGEXP_SUBSTR(param4_path,'[^#]+',1,GREATEST(1,REGEXP_COUNT(param4_path,'[^#]+'))) AS param4_with_last,
REGEXP_SUBSTR(param4_path,'[^#]+') AS param4_with_first
FROM hierarchy
ORDER BY unit_code
UNIT_ TREE LVL PARAM1_RAW PARAM1_WITH_LAST PARAM1_WITH_FIRS PARAM2_RAW PARAM2_WITH_LAST PARAM2_WITH_FIRS PARAM3_RAW PARAM3_WITH_LAST PARAM3_WITH_FIRS PARAM4_RAW PARAM4_WITH_LAST PARAM4_WITH_FIRS
00000 00000 1 Default value Default value Default value Default value Default value Default value Default value Default value Default value
10 10 2 Default value Default value Value from 10 Value from 10 Default value Value from 10 Value from 10 Default value
10-01 10-01 3 Default value Default value Value from 10 Default value Value from 10-01 Value from 10-01 Default value
10-02 10-02 3 Default value Default value Value from 10 Default value Value from 10 Default value Value from 10-02 Value from 10-02 Value from 10-02
20 20 2 Value from 20 Value from 20 Default value Value from 20 Value from 20 Default value Value from 20 Value from 20 Default value
20-01 20-01 3 Value from 20 Default value Value from 20-01 Value from 20-01 Default value Value from 20 Default value
20-02 20-02 3 Value from 20 Default value Value from 20-02 Value from 20-02 Default value Value from 20 Default value
7 rows selected.
SQL> SY.
Edited by: Solomon Yakobson on Nov 12, 2010 10:09 AM -
How to use the same POWL query for multiple users
Hello,
I have defined a POWL query which executes properly. But if I map the same POWL query to 2 portal users and the 2 portal users try to access the same page simultaneously then it gives an error message to one of the users that
"Query 'ABC' is already open in another session."
where 'ABC' is the query name.
Can you please tell me how to use the same POWL query for multiple users ?
A fast reply would be highly appreciated.
Thanks and Regards,
SandhyaBatch processing usually involves using actions you have recorded. In Action you can insert Path that can be used during processing documents. Path have some size so you may want to only process document that have the same size. Look in the Actions Palette fly-out menu for insert path. It inserts|records the current document work path into the action being worked on and when the action is played it inserts the path into the document as the current work path..
-
Error while creating a query for my custom infotype
Hi,
I have created a custom infotype with fields currency amount and currency field .
While I am creating a query for it its giving an error
Message no. AQ_AD_HOC221 Error when generating the report(see long text )
I tried to execute the standard program RPUMS40CCI but still I am facing same error .
I have also maintained table T777i for my infotype but still problem exists.
Please help.
PHi
Check in PM01 -
Return Code - Query for Multiple Rows as XML
Hi,
I'm executing an MSSQL stored procedure through the "Query for Multiple Rows as XML" activity in LiveCycle ES. I do this through a call statement such as this:
{ call MyStoredProc(?) }
This works great, the stored procedure always returns a record set (with or without records). I use this activity rather than "Call Stored Procedure" because I can transform the record set into XML right away within this activity. Unfortunately any exception arising from invoking this stored procedure cannot be handled within the workflow as this activity does not have an exception handler (lightning bolt). In an attempt to handle at least some exceptions we have decided to use try/catches within the stored procedures and return different error codes. Now the problem I am faced with is that there is no way to retrieve the returned code within any of the SQL activities. We don't want to have to write an execute script for each of these SQL calls. Is there any way to do this? Seems like I'm 95% there.
Thanks
NicThanks for the offer, unfortunately we would need something certified by Adobe.
Nic
Maybe you are looking for
-
Adding new fields to the data flow
Hi, I am currently planning to add some new fields in one DSO and map it (with info source) in the update rules. Will adding new fields to Info source - Comm. structure affect all the update rules connected to it? The info source is connected to mult
-
How can I export an SD 16:9 self contained file from FCX?
Hi folks, I'm playing with the trial. Used another thread to figure out how to import mts files (Loving the fact I don't have to clipwrap them! Original footage is in HD - 1920 x 1080. Upon importing it looks like it converts to ProRes422 1440 x 10
-
Can't get wireless PCI card to work
I bought a Sonnet wireless PCI card but we can't get it to work yet. Before I return it I wanted to check to make sure all the software was right. The AirPort utility is v4.2. The extensions are: Airport 3.4.7 Airport2 4.0 AirportFW 3.4.7 AirportFWAP
-
Linking between different websites
Hi How to get a couple of rows of from a search result of different website from ours. For eg.: I am entering a search criteria from http://www.a.com/examples/a.jsp and searching the result from www.b.com/examples/query?q=query Now, the tricky part i
-
Dear Team, We have created a vendor in which we have not checked the field "chk double inv" at the first instance. Posted some documents in vendor. Later on, we have decided to use the "chk double inv" functionality and then we have checked the fie