Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In the SharePoint list I am having the numeric column and the value is like this

123,456,789,012,346,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.

I am using SPQuery to retrieve items from the list. The following code is used for getting the column type

reader = XmlReader.Create(new StringReader(field.SchemaXml));
doc = new XmlDocument();
node = doc.ReadNode(reader);
if(item[field.Id] != null)
value = Convert.ToString(item[field.Id]);

I am getting the value as 1.02233335552222E+39 how could I get the actual value from the SharePoint list.

The field.schema.xml for the number column looks like this

"<Field Type="Number" DisplayName="Num Col" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" ID="{339280b6-4b74-45cb-9499-3a986c9d4c34}" SourceID="{16061cf5-90bb-406f-8c87-3bbf667bbbc7}" StaticName="Num_x0020_Col" Name="Num_x0020_Col" ColName="float1" RowOrdinal="0"/>"

With the help of schema.xml I'm not able to retrieve the actual value from the SharePoint list? Could anyone help me to solve this issue?

share|improve this question
add comment

1 Answer

That is the 'actual' value (or at least as close as you can get using doule precision floating point data types) - its just in a different notation to normal decimal because its so large.

E.g.

1.234E+6 = 1,234,000

(moved the decimal point +6 places to the right)

1.234E-6 = 0.000001234

(and -6 places to the left)

http://en.wikipedia.org/wiki/Scientific_notation

If you want to read this in .net then see SO - Convert from scientific notation string to float in c#

decimal d = Decimal.Parse("1.2345E-02", System.Globalization.NumberStyles.Float);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.