Note: This content was created before the release of 10.2.1a of Fiber Manager and may reference items that are not available prior to that release. However, the concepts and parts of the code can be applied at any release.

 

Our goal

In this post, I will walk you through creating a splice report like the following:

2014-08-15 13_34_12-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

It is concise and more black and white printer friendly than our default, out-of-the-box report (see below).

2014-08-15 08_25_05-C__Users_tmeli_Documents_ArcFM Solution_Fiber Manager_Reports_Splice_Report_442..png

 

Before we begin

In the following examples, we are using in-house data. Each customer will have customized their table and feature classes aliases or name. Therefore, many of the column names used here will have to be replaced with your names. In particular, column names are of the form name1_name2 where name1 is the table's alias or name and name2 is the column's alias or name. So, the column name BufferTube_Color represents the Color column in the BufferTube table.

 

Adding the Color Names

The first thing we are going to do is add fields to the existing report to show color names instead of actual colors or their underlying hexadecimal values. For this we are going to add the FIBERSPLICEREPORTFIELD model name on our buffer tube and fiber strand tables as described here: Configure Fiber Manager Reporting

This should turn our report into something like this:

2014-08-15 10_54_09-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

Yes, I know, we're heading in the wrong direction, we just added more data. But we'll deal with the colored columns in the next step.

 

Removing colored columns

Now, we can modify the XSLT to take out the colored columns. You will notice that each table is split into two different sections. A From section (left) and a To section (right) if you want. Let's address the first section.

In your XSLT file (SpliceReport.xsl), locate the xsl:for-each element that looks like this

 

<xsl:for-each select="SPLICEDTABLECOLUMNS/SPLICEDTABLECOLUMNNAME[.!='ReservedForInternalUse']">





 

In its current form, it only skips columns named ReservedForInternalUse (currently, only circuits). We are going to modify that element to skip our BufferTube_Color and Strand_Color column.

 

<xsl:for-each select="SPLICEDTABLECOLUMNS/SPLICEDTABLECOLUMNNAME[not(contains('ReservedForInternalUse BufferTube_Color Strand_Color', .))]">





 

and the resulting output:

2014-08-15 11_06_11-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

You can see that, while the column headers for those two columns have disappeared, the data is now misaligned. We need to apply a similar trimming to the actual data columns themselves. Locate the xsl:for-each element with a select similar to the following:

 

<xsl:for-each select="FROM/COLUMNS/COLUMN">





 

And now, let's replace it with the following:

 

<xsl:for-each select="FROM/COLUMNS/COLUMN[not(contains('BufferTube_Color Strand_Color', COLUMN_NAME/.))]">





 

and the resulting output:

2014-08-15 11_41_18-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

Now you can see that we still need to address the right-hand side columns. It is very similar to the left-hand side. Locate the xsl:for-each element similar to this:

 

<xsl:for-each select="TO/COLUMNS/COLUMN[not(contains('ReservedForInternalUse Atten1550 Atten1310 SpliceType Tray ', COLUMN_NAME/.))]">




 

You can see that we are already excluding duplicated columns such as circuits, attenuation and tray. We just need to add our color column names to the list as follows:

 

<xsl:for-each select="TO/COLUMNS/COLUMN[not(contains('ReservedForInternalUse Atten1550 Atten1310 SpliceType Tray BufferTube_Color Strand_Color ', COLUMN_NAME/.))]">




 

And the resulting output:

2014-08-15 11_42_48-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

Following similar concepts, we can hide columns like attenuation values get a more concise report by changing

 

<xsl:for-each select="SPLICEDTABLECOLUMNS/SPLICEDTABLECOLUMNNAME[not(contains('ReservedForInternalUse BufferTube_Color Strand_Color', .))]">




to

<xsl:for-each select="SPLICEDTABLECOLUMNS/SPLICEDTABLECOLUMNNAME[not(contains('ReservedForInternalUse BufferTube_Color Strand_Color Atten1550 Atten1310', .))]">




 

and

 

<xsl:for-each select="FROM/COLUMNS/COLUMN[not(contains('BufferTube_Color Strand_Color', COLUMN_NAME/.))]">




to

<xsl:for-each select="FROM/COLUMNS/COLUMN[not(contains('Atten1550 Atten1310 BufferTube_Color Strand_Color', COLUMN_NAME/.))]">




 

to obtain the following:

2014-08-15 11_48_49-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

 

Updating Column Names

Now, our column names use your data's configuration. So, in the current version of the report, you see Strand_Num, BufferTube_Name, etc. as the column name. With a little bit of XSLT work, we can change this to make it more friendly. Locate the block of XSLT that looks like the following (same as the previous section where we hid the colored columns):

 

<xsl:for-each select="SPLICEDTABLECOLUMNS/SPLICEDTABLECOLUMNNAME[not(contains('ReservedForInternalUse BufferTube_Color Strand_Color Atten1550 Atten1310', .))]">
  <th NOWRAP=''>
<xsl:value-of select="." />
  </th>
</xsl:for-each>


and change it to the following

 

<xsl:for-each select="SPLICEDTABLECOLUMNS/SPLICEDTABLECOLUMNNAME[not(contains('ReservedForInternalUse BufferTube_Color Strand_Color Atten1550 Atten1310', .))]">
  <th NOWRAP=''>
<xsl:choose>
   <xsl:when test='. = "Strand_Num"'>
  #
   </xsl:when>
   <xsl:when test='. = "BufferTube_Name"'>
  Tube
   </xsl:when>
   <xsl:when test='. = "Strand_Name"'>
  Strand
   </xsl:when>
   <xsl:when test='. = "SpliceType"'>
  Splice Type
   </xsl:when>
   <xsl:otherwise>
  <xsl:value-of select="." />
   </xsl:otherwise>
</xsl:choose>
  </th>
</xsl:for-each>


In the above example, we are replacing the Strand_Num header with a # sign, the BufferTube_Name with Tube and Strand_Name with Strand and finally, SpliceType with Splice Type. This gives us an nicer left-hand side, all with proper English header like this:

2014-08-15 13_08_09-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

You can read more online about the xsl:choose language construct and how you can leverage it for your needs. We can now look at the right-hand side columns and how to clean them up too.

 

Cleaning-up the right-hand side columns

Inside the xsl:for-each element with the select attribute starting with TO/COLUMNS/COLUMN, locate the xsl:variable element similar to the following:

 

<xsl:variable name="theName">
  <xsl:value-of select="COLUMN_NAME" />
</xsl:variable>


and replace it with the following:

 

<xsl:variable name="theName">
  <xsl:choose>
<xsl:when test='COLUMN_NAME = "Strand_Num"'>
   # : Tube : Strand
</xsl:when>
<xsl:when test='COLUMN_NAME = "BufferTube_Name"'>

</xsl:when>
<xsl:when test='COLUMN_NAME = "Strand_Name"'>

</xsl:when>
<xsl:otherwise>
   <xsl:value-of select="COLUMN_NAME" />
</xsl:otherwise>
  </xsl:choose>
</xsl:variable>


This construct leverages the xsl:choose element and condenses the right-hand side to look similar to the following:

2014-08-15 13_17_36-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

 

Updating the table header

We can now update the table's header section to span across all the left-hand side columns. This will give more room to the header information and actually allow other left-hand side columns to shrink a little bit. To do this, inside the xsl:for-each element with the select="SPLICELOCATION/SPLICEDTABLE" attribute, introduce a variable (called header_span for this example). We will then use that variable to populate the colspan attribute of the first tr and th element as follows:

 

<thead>
  <tr>
<xsl:variable name="header_span" select="count(SPLICEDTABLECOLUMNS/SPLICEDTABLECOLUMNNAME[not(contains('ReservedForInternalUse BufferTube_Color Strand_Color Atten1550 Atten1310', .))])+1"/>
<th COLSPAN="{$header_span}" NOWRAP=''>
   <xsl:value-of select="SPLICEDTABLE_NAME" />


 

The two important part of the above XSLT are:

  • make sure the argument passed to the count() method matches the value of the xsl:for-each element that follows (starting with SPLICEDTABLECOLUMNS/SPLICEDTABLECOLUMNNAME[not...)
  • don't forget the +1 at the end of the count to account for the circuits column (or you could drop the ReservedForInternalUse column from the contains() method inside the count()

2014-08-15 13_28_34-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

 

Conclusion

Your report should look like the following in the end:

2014-08-15 13_34_12-Miner.FiberManager • Miner.FiberManager (Debug_Any CPU) - Microsoft Visual Studi.png

You can find all the necessary files attached to this post