Select to view content in your preferred language

"There was a failure during tghe processing, check the Geoprocessing Result window"

2663
11
06-14-2011 01:42 AM
Annisa_IndahSari
Emerging Contributor
Dear all,

    I have a problem with VB Script where i want to use IF statement.
    For example: I have attributes:
    1. Quality Ratio (value, field type: double)
    2. Status (Text)
  
So what i want to do is:
    If the value in Quality Ratio is >= 0.81 then the Status is "High"
    If the value in Quality Ratio is <= 0.6 then the Status is "Moderate".
    Else is "Good".

   So far I have tried in VB Script using Field Calculator but it doesnt work. This is the script:
Dim Status as string
If [MEAN_QR] <= 0.6 Then
  Status = "Moderate"
elseif [MEAN_QR] >= 0.81
  Status = "High"
else
  Status = "Good"
end if

   
Then I always get this error message "There was a failure during the processing, check the Geoprocessing Result window for details".

Does anybody can help?

Annisa
0 Kudos
11 Replies
BruceNielsen
Frequent Contributor
If result is going into a field of type float then you shouldn't have the quotes around the value:
If [FUNC_CLASS] = 1 then
  result = 2.25
elseif [FUNC_CLASS] = 11 then
  result = 3.30
elseif [FUNC_CLASS] = 12 then
  result = 1.14
else
  result = 0
end if
0 Kudos
DarrenWiens2
MVP Alum
If result is going into a field of type float then you shouldn't have the quotes around the value:
If [FUNC_CLASS] = 1 then
  result = 2.25
elseif [FUNC_CLASS] = 11 then
  result = 3.30
elseif [FUNC_CLASS] = 12 then
  result = 1.14
else
  result = 0
end if

Just FYI, I tried calculating a float field to equal a number in quotes and it worked - I agree it shouldn't, but curiously it does. I'm using ArcGIS 10, SP2, and in the calculator VBScript parser.
0 Kudos