Decimal format

22/10/2007 - 10:28 por Decimal Number Problems | Informe spam
I have a custom list with autocalculate field (Number) then in sharepoint
designer I enter a xls datasource a dataview, and total sum like;

Header --> Work Hours
Line 1 --> Work1 1,20
Line 2 --> Work2 3,50
Line 3 --> Total 4,70

the first problem is that in the line 1 Hour I have NAN, because the output
format of the datasource is #,##0.00 (english number format) then I can't
convert in a number

The second problem is with the sum because $nodeset/@Hours containt a group
of nodes with 1,20 and 3,50 them I can't do this sum

I know that it's languajes insue, but I can't find the solution PLEASE HELP!!!
 

Leer las respuestas

#1 Fabian Imaz
24/10/2007 - 16:46 | Informe spam
Hola,

Antes que nada te pido disculpas por mi ingles, capaz no es el mejor :)

En el siguiente codigo que te adjunto establezco el formato que quiero que
se utilice en mi XSLT para darle formato a los nros.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:decimal-format name="euro" decimal-separator=","
grouping-separator="."/>
<xsl:template match="/">
<xsl:value-of
select="format-number(26825.8, '#.###,00', 'euro')"/>
</xsl:template></xsl:stylesheet>

Como veras estoy utilizando "decimal-format" en la declaracion del XSLT para
establecer el formato que deseo que utilice, después simplemente utilizo la
función "format-number" para formatear la salida de una variable.

Mi correo es , cualquier cosa a las ordenes.

Saludos,
Fabián Imaz
Siderys Elite Software
http://www.siderys.com


"Decimal Number Problems" wrote:

Como veo que hablas español, segiremos en español. el proble,a que tengo se
limita al formato de salida del spdatasource el cual me saca los números en
formato español o europeo 2.545,25 este campo es el campo de entrada en mi
funcion format-number, por lo que si convierto @pasta=2.256,25 en numero
format-number(@pasta,"el formato que sea") me da lo mismo, ya que le estoy
pasando como formato de entrada 2.545,25 la funcion format-number aceptaria
2,545.25. Solo quiero saber si hay alguna forma para indicar al sistema XLST
el formato internacional que debe usar ISO, para que cuando le llege este
tipo de dato lo interprete como un numero. El problema se reproduce tambien
en sum, ya que XLST no puede sumar un conjunto de lo que para mi son numeros
(2,05-6.252,52-5,25 ...)
Supongo que habra alguna forma de configurar xlst para indicar la
configuración internacional,

en sharepoint desing arrastro un origen de datos simplemente y le digo que
muestre campos numericos, y el sistema ya añade la funcion number-format,
pero no muestra los datos, tengo que quitar la funcion format-number para que
muestre los datos como texto, ya que no reconoce el formato 2.565,94 por lo
que yo creo alguna chorrada de configuracion

Por cierto Fabian, se me olvido 2 cosas la primera darte las gracias por
todo y lo segundo mi email


"Fabian Imaz" wrote:

> Hi,
>
> You can prove this function:
> ddwrt:FormatDateTime(string(@fec), 3082, 5), the first parameter is the
> field, a second parameter is the language, and the third is a type of format.
> The value of third parameter could be: 1,3,4,5,7,12,13 y 15, each value
> represent a diferent format for datetiem.
> Fabián Imaz
> Siderys Elite Software
> http://www.siderys.com
>
>
> "Decimal Number Problems" wrote:
>
> > Yes I do it, but the problem is the imput data, you can test
> > format-number(@Horurs, '#,##0.#;-#,##0.#'), @Hours=3.256,25 or directy
> > format-number(3.256,25, '#,##0.#;-#,##0.#'), both results are NaN, my
> > problems start when the sharepoint lists return the numbers in spanish
> > (european) format, 3.252,25 them format-number function Crash. It's happent
> > too with the sum function, how can I sum a node group of spanish numbers,
> > normaly I had to use sum ($nodeset/@Hours) but it's the same CRASH. when the
> > options in xls:decimal-format name=european decimal-separator=',' groping..>
> > you only express the output format, but I need that the function
> > format-number recognize de european format or the way to translate to english
> > format to convert in spanish format.
> >
> > But it's reallysubrealist, I only need that format-number recognize spanish
> > or europen format to translate my datafield in a number.
> > "Fabian Imaz" wrote:
> >
> > > Hi,
> > > You proved to use the functions of conversion and format of XSLT. When you
> > > use XSLT you can create expression xpaht with the sharepoint designer
> > > and there you found functions that helped you with this task. Here you have
> > > an example <xsl:value-of select="format-number(@ID, '#,##0.#;-#,##0.#')"/>.
> > >
> > > Fabián Imaz
> > > Siderys Elite Software
> > > http://www.siderys.com
> > >
> > >
> > > "Decimal Number Problems" wrote:
> > >
> > > > I have a custom list with autocalculate field (Number) then in sharepoint
> > > > designer I enter a xls datasource a dataview, and total sum like;
> > > >
> > > > Header --> Work Hours
> > > > Line 1 --> Work1 1,20
> > > > Line 2 --> Work2 3,50
> > > > Line 3 --> Total 4,70
> > > >
> > > > the first problem is that in the line 1 Hour I have NAN, because the output
> > > > format of the datasource is #,##0.00 (english number format) then I can't
> > > > convert in a number
> > > >
> > > > The second problem is with the sum because $nodeset/@Hours containt a group
> > > > of nodes with 1,20 and 3,50 them I can't do this sum
> > > >
> > > > I know that it's languajes insue, but I can't find the solution PLEASE HELP!!!

Preguntas similares