简体   繁体   English

在SharePoint Designer 2010 AllItems.aspx xslt视图中计算列

[英]Compute columns in SharePoint Designer 2010 AllItems.aspx xslt view

Could you please help me to implement following: 您能否帮助我实现以下目标:

I have custom list with 3 columns (LinkTitle, Location, Location2). 我有3列(LinkTitle,Location,Location2)的自定义列表。 If column Location2 is empty, it should take values from Location column 如果Location2列为空,则应从Location列获取值

I've made following, doesn't work: 我做了以下,不起作用:

<xsl:template name="FieldRef_header.Location2" ddwrt:dvt_mode="header" match="FieldRef[@Name='Location2']" mode="header" ddwrt:ghost="hide">
<th nowrap="nowrap" scope="col" onmouseover="OnChildColumn(this)">
  <xsl:attribute name="class">
    <xsl:choose>
        <xsl:when test="@Location2 != ''">
            <xsl:value-of select="@Location2" />
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="@Location" />
        </xsl:otherwise>
    </xsl:choose>
  </xsl:attribute>
  <xsl:call-template name="dvt_headerfield.Location2">
    <xsl:with-param name="fieldname">
      <xsl:value-of select="@Name"/>
    </xsl:with-param>
    <xsl:with-param name="fieldtitle">
      <xsl:value-of select="@DisplayName"/>
    </xsl:with-param>
    <xsl:with-param name="displayname">
      <xsl:value-of select="@DisplayName"/>
    </xsl:with-param>
    <xsl:with-param name="fieldtype">
        <xsl:choose>
            <xsl:when test="@Type='Number' or @Type='Currency'">number</xsl:when>
            <xsl:otherwise>x:string</xsl:otherwise>
        </xsl:choose>
    </xsl:with-param>
  </xsl:call-template>
</th>

Can't you do it with an additional Current Location Column of Calculated type, and Formula: 您不能使用计算类型和公式的其他“ 当前位置”列来执行此操作:

=IF( ISBLANK(Location2) , Location , Location2 )

That's the SharePoint Way 那就是SharePoint方式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM