Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Getting a calculated Column from a list

  Asked By: Rishi    Date: Oct 25    Category: Sharepoint    Views: 5072

SPPS 2003: We have a Work Orders list that has a calculated column
'OpenDays' that identifies how many days the WO has been open. I have an
application that displays a dashboard of the status of open work orders. The
I need to get the 'OpenDays' but when I loop through the list items using
For l = 0 To listItems.Count - 1

Dim item As SPListItem = listItems(l)

Dim la As Integer = 0

la = item("OpenDays")

I get an Error:

[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value,
NumberFormatInfo NumberFormat) +195
Value) +95

[InvalidCastException: Cast from string "float;#48.0000000000000" to type
'Integer' is not valid.]

How can I get the integer value ? I have haven't been able to find a way to
convert to integer.



1 Answer Found

Answer #1    Answered By: Silvia Wilkinson     Answered On: Oct 25

From the AspNetAnyQuestionIsOk@yahoogroups.com group this is what worked:
Dim OpenDaysRaw As String = item("OpenDays").ToString()

Dim OpenDaysValue As String = OpenDaysRaw.Substring(OpenDaysRaw.IndexOf("#") +

la = CInt(OpenDaysValue)

Didn't find what you were looking for? Find more on Getting a calculated Column from a list Or get search suggestion and latest updates.