Thursday, September 12, 2013

Simple XSLT to remove parent from parent child hier XML

There was a requirement to remove all the parents from the parent child hier and send only the child in XML.
Eg: 

 ListOfActionEmployee   
     Action_Emp
          Action 1
          Action 2
      /Action_Emp

     Action_Emp
          Action 3
          Action 4
    /Action_Emp
  .
  .
  .
/ListOfActionEmployee

Expected output

 ListOfExternalIO
          Action 1
          Action 2
          Action 3
          Action 4  
  .
  .
  .
/ListOfExternalIO

 Steps followed to remove the parents from the Hier
1. Created an outbound IO, for sending only the child i'e 'External IO'
2. Wrote XSLT as below
   ****************************************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
 <xsl:output method="xml" indent="yes" encoding="utf-16"/>
<xsl:template match="/SiebelMessage">
<SiebelMessage MessageId="{@MessageId}" MessageType="{@MessageType}" IntObjectName="External IO" IntObjectFormat="{@IntObjectFormat}">
     <ListOfExternalIO>
        <ListOfAction>
                <xsl:apply-templates select="ListOfActionEmployee/ActionEmployee/ListOfAction"/>
        </ListOfAction>
    </ListOfExternalIO>
</SiebelMessage>
 </xsl:template>
<xsl:template match="ListOfActionEmployee/ActionEmployee/ListOfAction/Action">
    <Action>
        <Id><xsl:value-of select="ActivityUID"/></Id>
        <IntName>ActionId</IntName>
    </Action>   
</xsl:template>
</xsl:stylesheet>
*******************************************

 Please comment if you need any further detail.

Saturday, September 7, 2013

How to query 'My' Activity

My activity means, all the activities where I am associated as employee.
Its MVF, so an activity can be associated to more then one employee.

Siebel maintains this association in S_ACT_EMP table, So every time an activity is created and associated to emp, a record is created in S_ACT_EMP.

Steps to query My Activity

1. Create Link
     Parent BC: Action Employee
     Child BC: Action
     Source Field: Activity Id
     Destination Field: Id

2. Create IO based on parent BC as Action Employee and Child BC as Action and using the link created above in BO

3. Once IO is created
query on Action Employee.Employee Id,
it will fetch all My Activity in parent child hierarchy.


How to query 'My Team' activity

My team's activity means all the activity associated to my primary position and all the activities associated to the position with which my position has direct/indirect relationship.

Siebel maintains this relationship in s_party_rpt_rel table.
PARTY_ID : is the primary position I'd
SUB_PARTY_ID : is the I'd of the position with which primary position has direct/indirect relation

Step to query my teams activity
1. Create link:
    Parent bc: Party Reporting Relationship
    Child bc: Action
    Source Field: Party Id (sub_party_id)
    Destination Field:  Primary Position Id (pr_held_position_id)

2. Create IO with primary bc as Party Reporting Relationship and child bc as Action and using the link created above in the BO.

3. Once IO is created 
Query on Party Reporting Relationship.Parent Party Id 
and it will fetch all my team activity in parent child hierarchy.