NaN in calculated field whith Infopath form linked to SQL Table

E

Edouard LECOQ

I created a Infopath 2007 form linked to a SQL 2005 database table.
SQL Table creation script :
CREATE TABLE [dbo].[Cout](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Qte] [float] NULL,
[PU] [float] NULL,
[Kamount] [float] NULL,
CONSTRAINT [PK_Cout] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

After disposing the data fileds as a table, I put the folowing formula as
default value for the Kamount field : "(@Qte * @PU) * .001"

When I run and post the form :
Qte = 1, PU = 100 000, result : KAmount = 100
Qte = 0.01, PU = 100 000, result : KAmount = 1
Qte = 0.03, PU = 100 000, result : KAmount = NaN

Can somebody explain to me the NaN result ?
NB : This occurs as well whith InfoPath 2003 and SQL 2000

Thank's
 
A

Arsenio Locsin

Edouard LECOQ said:
When I run and post the form :
Qte = 1, PU = 100 000, result : KAmount = 100
Qte = 0.01, PU = 100 000, result : KAmount = 1
Qte = 0.03, PU = 100 000, result : KAmount = NaN

Can somebody explain to me the NaN result ?

NaN means "Not a Number" or that the result is not recognized by InfoPath as
a number. For example, if you have a formula that multiplies a field
containing a number with a field containing text, the result would be NaN.

See if your calculation is not using or results in a value that isn't a
number.
 
E

Edouard LECOQ

Thank's for answer.
I know that NaN means not a number, but in the precise case I wrote, I do
not understand why, in the second and third cases, the result of 0.01 *
100000 / 1000 gives a number and the same operation with 0.03 instead of 0.01
gives NaN.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top