Query for Position Hierarchy

Hi friends,
I need urgent help. I have tried that Position Hierarchy query. If i give Bottom position id and Top position id , it should display that particular root only.
This is my query.
SELECT posname, subordinate_position_id, parent_position_id
FROM (
SELECT SYS_CONNECT_BY_PATH (pse.subordinate_position_id, '/') posname,
pse.subordinate_position_id, parent_position_id
FROM (SELECT NAME, position_id
FROM hr_all_positions_f_tl
WHERE LANGUAGE = USERENV ('LANG')) hap,
(SELECT NAME, position_id
FROM hr_all_positions_f_tl
WHERE LANGUAGE = USERENV ('LANG')) has,
per_pos_structure_elements pse
WHERE pse.business_group_id = 0
AND hap.position_id = pse.parent_position_id
AND has.position_id = pse.subordinate_position_id
START WITH pse.parent_position_id = 63--:parent_posid
CONNECT BY PRIOR pse.subordinate_position_id = pse.parent_position_id
AND PRIOR pse.pos_structure_version_id = pse.pos_structure_version_id
WHERE subordinate_position_id = 362--:subposid
Output coming like this :
Posname SUBORDINATE_POSITION_ID                 PARENT_POSITION_ID
/81/55/161/135/188/141/101/362 *362 101*
It returns one row only
i need Like this
subordinate positiond_id Parent_position_id
362 101
101 141
141 188
188 135
135 161
161 55
55 81
81 63.
How to achieve this.. Please help.
Thanks in advance.
Kavi

Try this
SELECT null posname, subordinate_position_id, parent_position_id, level_num
FROM (
SELECT distinct
--SYS_CONNECT_BY_PATH (pse.subordinate_position_id, '/') posname, --uncomment this line if necessary
level level_num,
pse.subordinate_position_id, parent_position_id
FROM (SELECT NAME, position_id
FROM hr_all_positions_f_tl
WHERE LANGUAGE = USERENV ('LANG')) hap,
(SELECT NAME, position_id
FROM hr_all_positions_f_tl
WHERE LANGUAGE = USERENV ('LANG')) has,
per_pos_structure_elements pse
WHERE pse.business_group_id = 0
AND hap.position_id = pse.parent_position_id
AND has.position_id = pse.subordinate_position_id
START WITH pse.parent_position_id = 63--:parent_posid
CONNECT BY PRIOR pse.subordinate_position_id = pse.parent_position_id
AND PRIOR pse.pos_structure_version_id = pse.pos_structure_version_id
WHERE subordinate_position_id = 362--:subposid
order by level_numMake sure that the you are using the correct values for the 3 IDs.
Hope this helps,
Sandeep Gandhi

Similar Messages

  • Query on Position Hierarchy

    Hi,
    How can we change top position in position hierarchy?
    It's grayed out..we need to change the top position holder
    Also we observed as when we query all the position hierarchies we see the same position name and holder at the top
    Please Advise
    Mahendra

    Prakash Kumar wrote:
    Hi Mahendra,
    For that first check that in all those position hierarchies, what is the top position. Once you get that, pleas let me know whether they are same or they are different. If they are same, it answers your query.
    While creating a new hierarchy, you need to define the hierarchy first and then save it. Then go to the lower block and select the top position (whatever you have got from the client) and save. Then you will get the option of going down with "Down Arrow" type key. There you have to select the sub-ordinate position and save. Like this you have define/attach all the position till the lowest of the hierarchy.
    There is another option of copying (and applying) the existing hierarchy to the new position hierarchy defined by you and then it can be modified as per your need.
    Thanks & Regards
    Prakash KumarThanks Prakash
    I am seeing same holder in all hierarchies..Now this is holder i need to change...as he is no longer with the client..
    I have done the same way as you said...
    First say i created one postion hierarchy name in postion hierarchy...and just save it...closed it..
    when i reopen or query the new position hierarchy...i see the same top position which i told you earlier is been defaulted...don't know from where purchasing is pulling it..hope you got my issue now...
    Now how and where it is been defaulted as the top position...
    only way is to end date that postion??
    Thanks
    Mahendra

  • Query for Supervisor Hierarchy for top most manager

    Hi,
    I have requirement where I have to start from one employee and move up to top-most supervisor of that employee:
    For example starting from Employee ABC and moving to supervisor3 through supervisor hierarachy.
    Employee ABC
    Supervisor1*
    Supervisor2*
    Supervisor3*
    Can anyone help me in constructing such query.
    Regards,
    Salman Ahmad

    The linked query is to find a loop in the Supervisor hierarchy top down.
    The SQL here will display the current supervisor hierarchy for a specified subordinate bottom to top.
    select level, rpad(' ',level*2)||paa.person_id, pap.first_name, pap.last_name
    from per_all_assignments_f paa
    join per_all_people_f pap
    on paa.person_id = pap.person_id
    and sysdate between pap.effective_start_date and pap.effective_end_date
    where sysdate between paa.effective_start_date and paa.effective_end_date
    start with paa.person_id = :PersonID
    connect by paa.person_id = prior paa.supervisor_id
    and sysdate between prior paa.effective_start_date and prior paa.effective_end_date;

  • Position Hierarchy Vs Organization Hierarchy

    Hi
    Our organization is position driven organization. I want to know what are the main advantages and disadvantages for Position Hierarchy and Organization Hierarchy.
    Because on top the hierarchies we will create security profiles.
    Can I have any document where I can find the comparison between both of these hierarchies.
    Thanks
    Gaurav

    No, the supervisor hierarchy is constructed simply by specifying supervisors on assignments.
    Added complexity can be added to the supervisor hierarchy in a multi assignment environment; you can then specify a 'supevisory assignment' as well but that is rare.
    It sounds like you will be invariable be drawn into using Positions. Having a 1-1 relationship between positions and employees is not unusual but be warned it can be extremely time consuming to maintain. I have been to organizations where position maintenance is virtually a full time job for a member of staff.
    If you are using Appraisals, definitely make use of the supervisor hierarchy, it is hard enough to implement correctly as it is without making it harder and trying to use the position hierarchy.
    You should be able to use the supervisor hierarchy for the OTL and iRec approval processes too but I'm happy to defer to other experts on the forum for those.

  • Query regarding the Position Hierarchy.

    Client Version:R12.1.3
    We are setting up Position Hierarchy.
    Have a query in the setup.
    We have a position called Clerk--Number of Holders---2
    Clerk --Holder 1 is reporting to Manager 1
    Clerk Holder2 is reporting to Manager 2.
    When we are trying to set the Hierarchy.
    It is taking both the holders in consideration.
    Request to assist.
    Thanks in advance
    Regards
    Srini

    914612 wrote:
    Dear user13056460,
    your query is very obvious you have a position type pooled and two employees are assigned to this position where in the hierarchy it shows two holder, if you want my opinion let each clerk have his own unique position as Clerk LA and CLerk DC by this you will not go through the headache of having two hierarchies and if youre having two hierarchies you need also to enable the document type (can change approval path option) the workflow engine by your scenario will get lost because two individuals have the same position so it will go to only one, options youre having
    1- let the postion with a two holder but enable the users to select approval path and employee while submiting PO's
    2- give each clerk a unique position name which is easier.
    Let me know if you have any more inquiries
    Regards
    Ammar M. GhazalehAmmar,
    That is what we have the requirment..
    I tried changing the existing hierarchy..but it is not working..
    For 2 clerks here..we created say 100.Purchase Clerk as Job and position as 200.Purchase clerk
    for the second clerk it has same job as 100.Purchase Clerk as Job and position as 200.Purchase clerk1
    (we changed a bit)
    one clerk reports to one manager..and the manager reports to dept head.
    one clerk reports to dept head..
    so while in hierarchy dept has total 3 sub ordinates and when we drill down manager has 1 sub ordinates..
    which makes sense...
    i created approval groups also...and assignments too..
    but when the newly created clerk logins and when he forwards documents..he is not seeing the default heiarchy..we have set this up in documents types..
    and the second old clerk he is seeing this when he is forwading documents for approval..
    where did i miss the setup?
    Please Advise
    Thanks
    Mahendra
    Edited by: 843237 on Feb 16, 2012 4:24 PM

  • TDS Amount on Vendor Advance Shows positive value in *QUERY* for TDS Report

    Hi Everybody,
    I have made a query for List of TDS Report with Vendor informations as required by my client. In which the value of TDS on Vendor Advance Payment appears as positive value instaead of negative value. Please suggest how to rectify.
    Thanks,
    Paul

    Dear,
    If you have cleared the advance in F-54, then this will reverse the tax amount. That could be the reason for tax amount in debit.

  • How to use position hierarchy for approval in custom workflow ?

    Dear All,
    I have created a custom workflow which fires when ever a new supplier site is created.
    Now I want to add approval hierarchy in this flow. For that I want to use Position Hierarchy.
    I have not find useful resources for doing that. Can you please help me?
    Regards,
    Rubayat

    Hi;
    Please review:
    How to Create a New Position Hierarchy [ID 437489.1]
    Adding Positions to a Hierarchy from Another Business Group [ID 356127.1]
    How To Determine Position Controlled Organizations In The Hierarchy? [ID 549628.1]
    How Does One Create and/or Update Position and Position Hierarchy in HR Using an API? [ID 736443.1]
    Using AME, How To Create Approval Routing To a Certain Position In HR Position Hierarchy [ID 1501433.1]
    Regard
    Helios

  • Newly Created Hierarchy Not appearing in Query for restriction

    Hi Experts,
    Iam new to dealing with hierarchies in BW.
    Our R3 team recently added node to 0material hierarchy. I went to infoobjects in RSA1 and under 0material i found two hierarchies
    Product Hierarchy for Material MARA &
    Reporting Hierarchy
    in the contect menu for "Product Hierarchy for Material MARA " i clicked chnage and in the screen that followed, i clicked display modified version and it showed new nodes added by R3 team. Then i clicked the Activate button and got it activated.
    We have a report which uses the Hierarchy and in it I cant find the new nodes..
    Can anyone please help me??
    This is very urgent..
    Thanks,
    DV

    Hi Edwin,
    I checked there..there is nothing in the list.
    DV

  • 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,
    LKR

    Hi,
    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.)

  • 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

  • Error in report for activated hierarchy

    Hello Experts,
                          I have following problem in my report:
    I have created 1 hierarchy for 0cust_sales infoobject other than Standard hierarchy.to get this hierarchy in place have done following steps:
    created authorization object with 0cust_Sales + Authorization for hierarchy infoobject 0TCTAUTHH and actiavted it in required data target.
    created authorization value for above hierarchy and maintained in the user role.
    then created 1 report where hierarchy for 0cust_Sales is active and 1 authorization variable has been created for that hierarchy and restricted 0cust_Sales.
    in my data target already 1authorization object is active which is based on 0sales_off.
    in my report where I have assigned 0cust_Sales hierarchy, 0sales_off hierarchy is also maintained.
    Problem comes when am executing the report where 0cust_sales hierarchy is not active with message - NO MASTER MAINTAINED FOR 0CUST_SALES HIERARCHY.
    My problem is, I want 0cust_sales hierarchy only in 1 report but as auth object of 0cust_Sales is active on data target, error comes whenever report NOT CONTAINING 0CUST_SALES hierarchy is executed.
    How to deal with the situation where hierarchy required only for 1 report..please guide me

    Thanks Ingo. We are going to open the case.
    Do we need to pull consistent detail objects of all the13 levels in the hierarchy to the WebI query ?
    For Example, I have pulled all 13 level dimension objects (Blue), Org unit Key (Detail Green Object) for only L03,L04 and Org Unit Medium Name  (Detail Green Object) for L08,L09.
    Do I need to pull all 13 dimension (Blue Object), all 13 Org Unit Key and all 13 Org Unit Medium Name? I mean do we need to select consistent detail objects consistent across the levels?
    Thanks
    Jai

  • Orgchart 3.0 doesn't show position hierarchy/detail due to (error) message?

    Hi all,
    at the moment we're implementing orgchart 3.0 (Product Version:7.0 Build Version:0700038500)
    When using the wizard for setting the position view and details under organizational unit it provides the following
    message/warning on the "profile"step as shown in the below link.
    http://dc459.4shared.com/img/EW1Zf8-Y/s7/0.7417648190801285/screencap.PNG
    This results in missing details for positions when publishing the build.
    All the transports (ABAP and add on package have been imported and all included tables, views fm's are available.
    Included an error log which is related to this issue?
    697. 29 nov 2011 15:45:20 ERROR com.nakisa.Logger - com.nakisa.integration.sap.BuildingBlocks : while trying to invoke the method org.w3c.dom.Node.getNodeType() of an object loaded from local variable 'node'
    698. 29 nov 2011 15:45:20 ERROR com.nakisa.Logger - java.lang.NullPointerException: while trying to invoke the method org.w3c.dom.Node.getNodeType() of an object loaded from local variable 'node'
    699. 29 nov 2011 15:45:20 ERROR com.nakisa.Logger - Nakisa.SAP.SAPProcessor.BAPI_Hroci : while trying to invoke the method com.nakisa.framework.data.DataTable.select(java.lang.String) of an object loaded from local variable '<6>'
    700. 29 nov 2011 15:45:20 ERROR com.nakisa.Logger - java.lang.NullPointerException: while trying to invoke the method com.nakisa.framework.data.DataTable.select(java.lang.String) of an object loaded from local variable '<6>'
    The orgchart can be accessed and a structure is show on O level
    but when trying to get in depth on position hierarchy we dont see any details or structure.
    Any idea what might be the problem/issue and how to solve this?
    Thanks in advance
    Carlos

    Luke,
    thanks for your helpful and quick response.
    Still have some additional questions/queries:-) as this is the first time we
    try to implement orgchart.
    So if I'm correct we need to undeploy the current SMP build of Nakisa 3.0
    and deploy the latest build with SP2?
    Or can we just deploy the latest build on our NWCE without any issues?
    Regarding the 3.0 SP2 is this included in the latest build or do we need to download thisseperate from the SMP?
    Can we resuse the current orgchart config builds in the latest build or is it advisable to configure
    orgchart with a clean build?
    Thanks in advance
    Regards,
    Carlos
    Hi Carlos,
    You are using the SMP build which contains quite a few bugs. I highly recommend that you contact SAP Support for the latest version and I strongly recommend that you implement 3.0 SP2 (the build you have deployed is 3.0 without any SPs). SAP Support will supply the latest version of the build upon request.
    Best regards,
    Luke

  • 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,
    -Tim

    Hi 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

  • 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • 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...

Maybe you are looking for

  • Vstest.console.exe does not find emulators on non-english windows

    Hi all, I am currently setting up my TeamCity build steps to build my app, deploy it to the emulator and then run unit and UI tests projects on it. For deploying, I use "AppDeployCmd.exe /install app.appx /targetdevice:6" where "6" is the ID of the e

  • Help iPad wont charge with either

    Can someone please help me, iv only had my iPad a few days, now it wont charge, I have tried both the plug and USB connections and still wont charge have even left them in for two whole days any suggestions or has it got to back to shop I brought it

  • Table that store info about pages

    Hi, I would find the name of table (or view) that store information about PAGE. In particular, I would find the name and the display name of item (simple file, image, URL...) wich are contained in a page. Thank you in advanced

  • Need design(forecast)

    Hi Gurus, We do forecast monthly for every 6 months. I need to report previous months(history) and current 6 months forecast data in the report. What is the best  design for this requirement. For example First time I need to load forecast data from 0

  • How to avoid starting of workflow ?

    hi there, i have a problem: on BO BUS2089 (Travel) i have a event 'CREATED' on that event i have a workflow. everytime the event is raised the workflow starts. so far so good, BUT: i ONLY want to start the workflow when the travel-request is created