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

1683
11
06-14-2011 01:42 AM
Annisa_IndahSari
New 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
DarrenWiens2
MVP Honored Contributor
VB allows you to dim as a datatype. VBScript doesn't. Delete "as string".
0 Kudos
Annisa_IndahSari
New Contributor
Dear Darren,

I hope I understood you well.
I have tried this script with field "Status" string.
[QR] >= 0.4
If [QR] <= 0.6 Then
Status = "Moderate"
ElseIf [QR] >= 0.81 Then
Status = "High"
Else
Status = "Good"
End If


With these script i don't get error message anymore but all the results are -1.

So I change the field into Double and also tried with Short Integer with this script:
[QR] >= 0.4
If [QR] <= 0.6 Then
Output1 = 3
ElseIf [QR] >= 0.81 Then
Output1 = 1
Else
Output1 = 2
End If


Then all the results are always zero.

Do u know where the mistake is?

Thanks!
0 Kudos
DarrenWiens2
MVP Honored Contributor
Your first line is trying to assign a value of "greater than or equal to 0.4" to the field [QR]. I assume what you mean is "[QR] is equal to 0.4" or: [QR] = 0.4
0 Kudos
JuniorBurnett
New Contributor
Hi All,
good afternoon I am do a raster calculation where I'm add about 13 different layers for EAB susceptibility project. The out raster is coming without a value and the following statement shown up Statistics have not been calculated) What can I do to correct this please?
0 Kudos
Annisa_IndahSari
New Contributor
I just wanna simply grouped my data into three interval:
Status HIGH has QR = 0.81 - 1.0
status GOOD has QR = 0.61 - 0.8
Status MODERATE has QR = 0.6 - 0.4

So the first line should be like this:
If [QR] < 0.4  then [QR]==0.4 else [QR]==[QR]?
0 Kudos
Annisa_IndahSari
New Contributor
Hi All,
good afternoon I am do a raster calculation where I'm add about 13 different layers for EAB susceptibility project. The out raster is coming without a value and the following statement shown up Statistics have not been calculated) What can I do to correct this please?


Hey I think you should go to this link http://forums.arcgis.com/forums/31-Geoprocessing
and click "+Post New Thread"
0 Kudos
DarrenWiens2
MVP Honored Contributor
In the code block:
If [QR] > 0.8 then
result = "High"
elseif [QR] > 0.6 then
result = "Good"
elseif [QR] > 0.4 then
result = "Moderate"
else
result = ""
end if

In the expression:
result
0 Kudos
Annisa_IndahSari
New Contributor
In the code block:
If [QR] > 0.8 then
result = "High"
elseif [QR] > 0.6 then
result = "Good"
elseif [QR] > 0.4 then
result = "Moderate"
else
result = ""
end if

In the expression:
result


WOW...! It does work!!!!
AWESOME! MANY MANY THANKS Mr. Weins!
0 Kudos
ChaitanyaPathak
New Contributor
Hi Everyone,
I have similar problem and went through the thread and tried the code provided by Mr. Weins and also followed the conversation of annisaindah however my problem still
persist. To add more information when I created the field I have Field Property Type as Float and not sure if it makes a difference. I was trying something on the same lines as below:


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

I am still getting the same error message  "There was a failure during tghe processing, check the Geoprocessing Result window" Can someone please guide me where I am going wrong? Any help is highly appreciated.
Thanks
0 Kudos