대신 백분율 값을 표시합니다
-
10-12-2019 - |
문제
SharePoint 2007을 사용하고 SharePoint Designer 2007을 사용하여 사용자 정의보기를 개발합니다.
백분율로 숫자를 표시 해야하는 테이블의 열입니다.최소값은 0, 최대 100입니다.
SP 디자이너에서 제안 된 코드를 사용하고 있습니다 :
<xsl:value-of select="format-number(@Probabilit_x00e0_, "###0,%;-###0,%", "lcid1040")" />
.
그러나 0 또는 100과 같은 숫자를 삽입하지 않으면 항상 "NaN"을 볼 수 있습니다.기본값이 설정되지 않았습니다.
왜?
해결책
You could capture the formatted number first and then check for a NaN value.
<xsl:variable name="myValue" select="format-number(@Probabilit_x00e0_, "###0,%;-###0,%", "lcid1040")" />
<xsl:choose>
<xsl:when test="string(number($myValue))='NaN'">0</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$myValue" />
</xsl:otherwise>
</xsl:choose>
This will switch out NaN for a zero.
다른 팁
When using "format-number", it expects a period separator for decimals. With the percentage field (LCID 1036 for french), the decimals separator is a comma.
I had to translate the comma to get it working correctly. I haven't checked if it is the same thing for 1033 or 1040 in this case.
format-number(string(translate(@PercentField,',','.')), '#,##0%;-#')
제휴하지 않습니다 sharepoint.stackexchange