Ad

Friday, June 06, 2008

Fixing the Surface Report

The Surface Report found in the Toolbox is not set to output the values in the correct precision. This means you get all twelve digits wether you want them or not. I wasn't able to figure out how to pull the string values from the XML report directly, but was able to hard code the formatting into the report.

To make the change go into the SurfaceReport.xsl file using notepad or another editor and change the line that contains @area2DSurf to the following:

<td>Area 2D: <xsl:value-of select='format-number(./lx:Definition/@area2DSurf,"##.##")'/>

The "##.##" indicates it is going to round the value to two digits. If you want another precision just add or subtract #'s. Make the same type revisions elsewhere in the document and then save the file and run the report again. Make sure to create a backup copy of the report just in case you want to go back to the original file.

Here's another example:
Original Line of code:
<td>Volume Cut: <xsl:value-of select="@volCut"/>
Revised line of code:
<td>Volume Cut: <xsl:value-of select='format-number(@volCut, "##.##")'/>

6 comments:

Anonymous said...

Hi Christopher,
you're a champion. This has been killing me for two years. Have tried off and on to understand XML language to correct it but no luck. Do you have any reference books could could recommend on learning XML?
Thanks again.
Ben

Christopher Fugitt said...

I don't have anything other than the web. I think for this post I searched for formatting numbers and XML. There are editors out there that will make it easier, I just haven't had a chance to mess with them.

Anonymous said...

Hi Christopher,
really your are the best.
I'm trying to write a code to customize a different format for the Section View and I need the values of the areas of cutting and fill of each section ( "@ areaCut" and "@ areaFill" into the SurfaceReport.xsl file). You could help me?
thanks
Sergio from Brasil

Christopher Fugitt said...

Are section views available via XML?

Meagan said...

I know very little about XML/XSL but I did manage to change a few things in my surface report (Changed a few headings, figured out   for a space, etc. I added a line for Average Height Difference and am trying to get it to return @volTotal div @area2DSurf. @volTotal is a number...I can get it to return @volTotal divided by other numbers but @area2DSurf only returns NaN...but it IS a number...???
Can you help?
Meagan from Canada
(By the way the rest of your posts have been really helpful!)

Christopher Fugitt said...

I don't know much about what's wrong Meagan. I'd try making it a text string and output the result to Excel instead of Internet Explorer and see if the formula calcs it for you. Not sure if that would work though.

LinkWithin

Blog Widget by LinkWithin

Ad