سؤال

أنا أستخدم SharePoint 2007 وتطوير طريقة عرض مخصصة باستخدام SharePoint Designer 2007.

لدي عمود من الجدول الذي يجب أن يعرض أرقاما كنسبة مئوية.قيمة الحد الأدنى هي 0، 100 كحد أقصى.

في SP مصمم أنا أستخدم الرمز المقترح: giveacodicetagpre.

ولكن، ما لم أدرج رقم مثل 0 أو 100، أرى دائما "نان".لم يتم تعيين القيمة الافتراضية.

لماذا؟

هل كانت مفيدة؟

المحلول

You could capture the formatted number first and then check for a NaN value.

<xsl:variable name="myValue" select="format-number(@Probabilit_x00e0_, &quot;###0,%;-###0,%&quot;, &quot;lcid1040&quot;)" />
<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%;-#')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top