zibros

ArcGIS Field Calculation Multi Conditions

Discussion created by zibros on Nov 2, 2018

#Dear All, please advice me,

 

I have a series of data for 2 years, with interval 1 hour every record.

 

I want to make group every 3 days in same month and same year become a number in GROUP field

 

I did the script below and it well run

Dim n

if [Day] >=1 and [Day] <= 3 and [Month]  = 1 and [Year] = 2016 then

   n = 1

elseif [Day] >= 4 and [Day] <=6 and [Month]  = 1 and [Year] = 2016 then

   n = 2

elseif [Day] >= 7 and [Day] <=9 and [Month]  = 1 and [Year] = 2016 then

  n =  3

elseif [Day] >= 10 and [Day] <=12 and [Month]  = 1 and [Year] = 2016 then

  n =  4

elseif [Day] >= 13 and [Day] <=15 and [Month]  = 1 and [Year] = 2016 then

  n =  5

elseif [Day] >= 16 and [Day] <=18 and [Month]  = 1 and [Year] = 2016 then

  n =  6

elseif [Day] >= 19 and [Day] <=21 and [Month]  = 1 and [Year] = 2016 then

  n =  7

elseif [Day] >= 22 and [Day] <=24 and [Month]  = 1 and [Year] = 2016 then

  n =  8

elseif [Day] >= 25 and [Day] <=27 and [Month]  = 1 and [Year] = 2016 then

  n =  9

elseif [Day] >= 28 and [Day] <=30 and [Month]  = 1 and [Year] = 2016 then

  n =  10

elseif [Day] = 31 and [Month]  = 1 and [Year] = 2016 then

  n =  11

else

  n =  0

end if

 

I think the script is not good for calculate for 2 years (9353 records), too many line condition

 

Any way to make simple the script for that, the data table attached.

 

Best\

Zibros

Attachments

Outcomes