New Cost Capabilities in the 6.2 release

Post Reply
JohnM
Posts: 468
Joined: 17 Feb 2009, 20:19

We’ve added a cost for element relation in the 6.2 release that allows you to tie cost to any object in the repository

You can see the meta model on the Key Model Elements page https://enterprise-architecture.org/models.php, click the Management Cost link at the bottom to see the meta model.

To see it working, the Application Summary View in Labs adds a cost field to the summary that sums the costs against the application.

If you wish to add costs to your own views the below function consolidates the amounts of cost components.

<xsl:function as="xs:float" name="eas:get_cost_components_total">
<xsl:param name="costComponents"/>
<xsl:param name="total"/>

<xsl:choose>
<xsl:when test="count($costComponents) > 0">
<xsl:variable name="nextCost" select="$costComponents[1]"/>
<xsl:variable name="newCostComponents" select="remove($costComponents, 1)"/>
<xsl:variable name="costAmount" select="$nextCost/own_slot_value[slot_reference='cc_cost_amount']/value"/>
<xsl:choose>
<xsl:when test="$costAmount > 0">
<xsl:value-of select="eas:get_cost_components_total($newCostComponents, $total + number($costAmount))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eas:get_cost_components_total($newCostComponents, $total)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$total"/></xsl:otherwise>
</xsl:choose>
</xsl:function>


To get the cost components, add these lines to the variables section of your xsl, before <xsl:template match="knowledge_base">:

<xsl:variable name="inScopeCosts" select="/node()/simple_instance[own_slot_value[slot_reference = 'cost_for_elements']/value = {instance ypu want costs for}/name]"/>
<xsl:variable name="inScopeCostComponents" select="/node()/simple_instance[name = $inScopeCosts/own_slot_value[slot_reference = 'cost_components']/value]"/>


Note: if you are want to have costs for multiple instances, not one, for example in a table, then you need to put these variables in the template where each element is being called.

The get the currency add these to the variables section:

<xsl:variable name="currencyType" select="/node()/simple_instance[(type = 'Report_Constant')][own_slot_value[slot_reference = 'name']/value='Default Currency']"/>
<xsl:variable name="currency" select="/node()/simple_instance[(type = 'Currency')][name=$currencyType/own_slot_value[slot_reference = 'report_constant_ea_elements']/value]/own_slot_value[slot_reference='currency_symbol']/value"/>


To call the function, add the following line in the template:

<xsl:variable name="costTypeTotal" select="eas:get_cost_components_total($inScopeCostComponents, 0)"/>

Then display the output using:

<xsl:value-of select="$currency"/><xsl:value-of select="format-number($costTypeTotal, '###,###,###')"/>

Post if you have any questions. Let us know how you get on, and please share any cost views you create.

John
Post Reply