Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and Listformating a Calculated field.formating a Calculated field.
Previous
 
Next
New Post
11/13/2008 8:55 PM
 

I have recently started using User defined XSLT to display my user defined Tables. I have a field that is a calculated column and its format should be .000 I use this as a winning % coulmn. The formula is IIF(win+loss=0, win/1 , win/(win+loss)) and it is a Decimal type field. When I apply the following xsl I get a result of NaN. How do I fix this?

 

<td class="stndtd">
        <xsl:variable name="NameOfValueColumn" select="udt:ValueColumn"/>
        <xsl:variable name="FieldTitle" select="udt:FieldTitle"/>
        <xsl:choose>
         <xsl:when test="$FieldTitle='W%'">
          <xsl:variable name="FieldValue" select="udt:Data[udt:UserDefinedRowId=$id]/*[name()=$NameOfValueColumn]" />  
          <xsl:value-of select="format-number($FieldValue,'.000')" disable-output-escaping="yes"/>
         </xsl:when>
         <xsl:otherwise>
          <xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$NameOfValueColumn]" disable-output-escaping="yes"/>  
         </xsl:otherwise>
        </xsl:choose>
       </td>

 
New Post
11/14/2008 1:40 PM
 

Replace 

   <xsl:when test="$FieldTitle='W%'">
          <xsl:variable name="FieldValue" select="udt:Data[udt:UserDefinedRowId=$id]/*[name()=$NameOfValueColumn]" />  
          <xsl:value-of select="format-number($FieldValue,'.000')" disable-output-escaping="yes"/>
   </xsl:when>

with

   <xsl:when test="$FieldTitle='W_x0025_'">
           <xsl:value-of select="format-number(udt:w_x0025_,'.000')" />
   </xsl:when>

Can you please explain why everybody goes the hard way and alters the included stylesheets instead of using the build in XSL generator? Is that feature to difficult to find?

 

 
New Post
11/14/2008 2:59 PM
 

Stefan,

Thanks for your reply. This did not work. When I use this method

<xsl:variable name="FieldValue" select="udt:Data[udt:UserDefinedRowId=$id]/*[name()=$NameOfValueColumn]" />  
<xsl:value-of select="format-number($FieldValue,'.000')" disable-output-escaping="yes"/>
 

or this method

<xsl:value-of select="format-number(udt:w_x0025_,'.000')" />

They both return a NaN. Are calculated fields stores as numbers? is that the problem?

As far as you second question. I did not notice the XSL Generator button and in my case I am new to XSL and it was easier for me to look at examples and figure out how it works. I hope that helps.

 
New Post
11/15/2008 3:23 AM
 

Ray,

you can check that on your own, just check the XML (ActionMenu, "Show Data As XML"). It should be a number.

Did you test also in DataGrid mode? Are the source columns win and loss declared as decimal? 

 


I should make the "Generate New" button much bigger than, or I should add warnings to the build in stylesheets:

WARNING

This stylesheet is NOT intended as template for your own stylesheets. All built in stylesheets were written to work against any possible UDT configuration.
Please use the custom XSL stylesheet option and the buildin Token To XSL Editor and Generator, available through the  "Generate New" lin
k.

 
New Post
11/15/2008 7:25 PM
 

Here is the XML for that column.

<Fields>

  <UserDefinedFieldId>431</UserDefinedFieldId>
  <ModuleID>895</ModuleID>
  <FieldTitle>W%</FieldTitle>
  <Required>false</Required>
  <FieldOrder>11</FieldOrder>
  <FieldType>Expression</FieldType>
  <default>IIF(win+loss=0, win/1 , win/(win+loss))</default>
  <Visible>true</Visible>
  <ShowOnEdit>true</ShowOnEdit>
  <Searchable>false</Searchable>
  <InputSettings>Decimal</InputSettings>
  <OutputSettings>.000</OutputSettings>
  <NormalizeFlag>false</NormalizeFlag>
  <ValueColumn>W_x0025_</ValueColumn>
  <SortColumn>W_x0025_</SortColumn>
  </Fields>

The win and loss columns are Integers.  This worked perfectly when I used the data grid mode. The only reason I moved to XSL was to provide a more detailed style.

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and Listformating a Calculated field.formating a Calculated field.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out