VBScript (Visual Basic Scripting Edition) is an Active Scripting language developed by Microsoft that is modeled on Visual Basic.

learn more… | top users | synonyms (1)

14
votes
2answers
5k views

How can I create weighted Thiessen polygons?

I have a point shape file and I create Thiessen (Voronoi) polygons programmatically using this scripting syntax: CreateThiessenPolygons_analysis (in_features, out_feature_class, fields_to_copy) ...
7
votes
2answers
572 views

Parsing serial date in ArcGIS for Desktop?

I have imported a shapefile that contains a serial date number that looks like this: 41256.260799. I would like to create a new field that shows only the hour and second like this: 06:33. I've tried ...
7
votes
1answer
1k views

ArcMap 10: How do I escape certain characters when labeling?

I am labeling certain Oil & Gas areas by Operator in ArcMap 10, using this expression: "" & [OPERATOR] & "" & vbNewline & "" & [UNIT_NAME] & "" The only problem is ...
6
votes
3answers
6k views

Field Calculator syntax?

I can't get the syntax correct for a fairly simple if statement. Right now it looks like this: dim Output as Integer If [HECTARES] >= 30 AND [HEIGHT] >= 17 AND [CROWN] >= 59 THEN Output = ...
4
votes
2answers
9k views

How to convert field values from lower case to upper case in ArcGIS 10.1?

Using the Field Calculator in ArcGIS 10.1, I am able convert the first letter in a value from lower case to upper case. How do you convert the entire value to upper case, though? I can't seem to ...
4
votes
1answer
1k views

VB scripting in ArcGIS Field Calculator?

In my attribute tables field I am trying to get rid of the "&" in between names i.e. "John Adams & wife" and want it to say "John Adams and Wife" in all the attributes with "&". What is ...
4
votes
2answers
6k views

If/then VBScript/Python code equivalent to SQL IN ('x','y',z') expression in ArcGIS Field Calculator?

we need just like the following, only with multiple records selected... have tried the "xyz" in (1,2,3,4,5) SQL code but of course VB Script wants something else. dim f2 if [field1] = "foo" then f2 ...
4
votes
2answers
99 views

Dropping & inserting specific characters within a field being used for labeling

I would like to find out how to properly format a conditional expression in labeling, so as to only get specific characters back out of a field that has 9 characters in it, but don't wish to label ...
4
votes
1answer
6k views

Field Calculator VB Script Codeblock IF statement syntax is wrong?

I can't figure out why the syntax is wrong in Field Calculator ArcMap 10. The complete codeblock is Dim CapitalDia As Number Dim TwagDia As Number Dim X As Number CapitalDia = [New_Pipe_S] TwagDia =...
4
votes
2answers
6k views

Nested “if” statements in ArcGIS Field Calculator

The solution in VB for the base process is @ "If then" VB Script code (or Python) equivalent to SQL's IN ('x','y',z') expression in ArcGIS Field Calculator question? ...
4
votes
1answer
2k views

Running VB scripts in ArcGIS Desktop?

Some questions about VB scripts: Can I read and modify the code of a VB script? If the answer is yes, how can I do it? How can I run a VB script? Can I use it as a VBA code eg.using variables ...
4
votes
1answer
53 views

Change entire label style after certain extent

I need to design a dynamic label in ArcMap that changes its entire style after a certain zoom extent. The research I've done suggests to me that there is currently no way to use VBscript to manipulate ...
4
votes
4answers
4k views

How to concatenate numbers and add in leading zeros?

I have three text fields populated as follows: 1, 9, 1 that I need to concatenate into a field that looks like 01.09.01. Getting to 1.9.1 is easy but can anyone help out with how to formulate it so ...
4
votes
2answers
8k views

Remove first n characters in label using ArcGIS 10 label expression builder with VBscript

I have a planning cadastre dataset. It has the type of plan (DP, RP or SP) and then the plan number, thusly: DP123456 RP1248590000 SP3855 etc... I want to make a label in the expression builder in ...
3
votes
2answers
331 views

VB Script or Python for Field Calculator when using greater/less than?

What I have: I have 4 fields for my address ranges. L_ADD_FROM, R_ADD_FROM, L_ADD_TO & R_ADD_TO (all in DOUBLE field type). What I need: The lesser value from L_ADD_FROM and R_ADD_FROM to ...
3
votes
2answers
8k views

Using conditional statements in Field Calculator

I have two fields, "P_Area" and "PC_Area", whose sizes I'd like to compare in a third field, "Areas_Equal". The "Areas_Equal" field should contain a "Yes" if the other two are equal and a "No" if they ...
3
votes
2answers
443 views

Removing 0 values when labelling an integer field

I am trying to do a simple labelling exercise however I am a bit stuck on how to remove unwanted '0' values. I have three fields which I would like to display in a stacked label i.e. on three lines. ...
3
votes
2answers
189 views

Calculate QUARTER from Date field using ArcGIS Field Calculator?

I currently have a Date field in the format of MM/DD/YYYY. My goal here is to convert the Dates into 1 of 4 quarters, along with the Year. The field to be created will be called QTR_YR. My first ...
3
votes
2answers
225 views

Updating new field from existing field using ArcGIS Desktop?

I need to update my new field/column (Property Type) with either "detached", "semi", or "terrace" depending on an existing column (Property Count): where the count = 1 I need to populate Property ...
3
votes
1answer
38 views

Using ArcGIS Field Calulator with VB Script

My code looks like the following: if [LWS50yrp] <136.5 then [DMG_50y] = 0.1 elseif [LWS50yrp] >=136.5<154 then [DMG_50y] = 0.15 elseif [LWS50yrp] >=154<166 then ......
3
votes
2answers
71 views

Why is VBS If Then Label Expression not working?

I am trying to label a field based on other field. For [TYPE] = "PRIMARY", the [LABEL] is having this structure: "TAN80901B" For [TYPE] = "SECONDARY", the [LABEL] is like this: "TAN80901C/D20b" I ...
3
votes
3answers
3k views

How to Populate new field using expression containing MAX value from another field in ArcGIS attribute table using field calculator?

I've got one field X with 10 numerical attributes (float/double). I've created a new field Y (also float/double) which I need to populate with the percentage of each record/attribute (in each of the ...
3
votes
2answers
77 views

VBscript to not include empty fields

I am trying to create a label in arcgis with about 30 columns with this basic VBscript: [field1] & vbnewline & [field2] & vbnewline &[field3] & vbnewline... ETC How can I make ...
3
votes
2answers
122 views

Using ArcGIS Desktop field calculator (python) to parse date

I'm trying to parse a datetime field using python (but have never used python for it before). I have a field that contains a valid date, but not a valid time... and other fields that have valid hour ...
3
votes
1answer
526 views

Why is this field calculator expression evaluated incorrectly when using Python syntax?

I have a polygon featureclass containing an integer field 'gridcode'. I've added 2 new float fields VB_calc and Python_calc, both of which should be equal to gridcode / 1,000,000. If I calculate the ...
3
votes
3answers
854 views

How to make Field Value constant size (length) by appending zeros towards end?

How do I append my field values in my .dbf to correspond with the values of my feature's attribute table. I need to append 0's to the field value if the field value is less than 11 characters in ...
3
votes
1answer
1k views

VBscript Regular Expression in ArcMap Field Calculator

I'm looking for a regex in VBscript that I can use on a ArcMap table. I know what it would look like in python: pat =r'[0-9]{3,4}' This filters all numeric characters from the string which have the ...
3
votes
4answers
3k views

Label using VBscript in ArcMap - multiple IF statements?

I have 4 fields that hold number values. I only want a label returned if the field <>0. For instance, if col1<>0, then label = col1 AND if col2 <>0 then label = col2, etc. So, I want all ...
3
votes
2answers
43 views

Using Field Calculator vb to check for name with /n in the string?

I am calculating values for a field (Score) based upon the names from another field (Modified). One name is "blaugh\nblaugh". Field Calculator keeps treating the name as having a new line command. I ...
3
votes
1answer
330 views

Set scale dependant labels arcmap 10.3

I am wondering if it is possible to create scaled labels so that at a certain zoom level only one label appears but when you zoom in closer more labels appear for different fields. I have this ...
3
votes
1answer
161 views

Merge String fields in ModelBuilder by undefined ArcGIS user?

I'm using ArcGIS 10. I have a doubt, because I already have a merged shapefile, with two string Fields, some Null and some filled (comes from the merge tool). So, now I want to get the values from ...
3
votes
1answer
522 views

Convert ArcMap label expressions from VBScript to Javascript or Python

I have a large number of layers (hundreds) with label expressions written in VBScript. I am using ArcMap 9.3.1, and I'm now starting to export the layers as MPKs for use in our ArcGIS Runtime (WPF) ...
3
votes
1answer
807 views

ArcPad 10 Studio, from form to vbscript back to form

There is very little documentation on using vbscript within a form. Any help with syntax for ArcPad 10 would be appreciated. Within my subroutine, I want to grab some numerical data entered in a ...
3
votes
0answers
34 views

VBScript Syntax Error in ArcGIS labeling? [closed]

I have been using a script on older ArcGIS to convert depths in engineering format to the Hydrographic format seen on charts. On trying to use it I get a syntax error in Line 14. No matter how I ...
3
votes
2answers
1k views

Multiline VBScript Label Expressions in Arcpy

I am able to set simple label expressions, but when I try to set multiline expressions (which all VBScript expressions are) it does not get copied into the expression box properly. I have tried using ...
2
votes
2answers
175 views

Troubleshooting VBScript for labeling in ArcMap?

I am trying to add FIPS codes to my county name labels and want to add either one or two zeros to the number unless it is over 100. i'm hoping someone can find the error in my code: Function ...
2
votes
1answer
220 views

Is there an equivalent of ArcGIS Hyperlink script editor in QGIS?

I am trying to find similar functionality in QGIS to ArcGIS Hyperlink script editor. In ArcGIS I can parse VBScript from a selected field in an attribute table. The script would execute on mouse ...
2
votes
1answer
141 views

Using ArcMap Field Calculator to count number of identical values?

I have a file with an attribute table with data in 3 columns, and would like to use field calculator to populate a 4th column. The data is integer numbers between 0 and 56. I want the new column to ...
2
votes
2answers
4k views

ArcMap field calculator VBScript

I want to do some advanced level scripting with VBA in the field calculator. I have done a simple coding in the code block. Here is the codes. dim X if [Name]="University" then X=101101 ...
2
votes
1answer
68 views

Inserting substring in ArcGIS Field Calculator

Trying to use the split tool in ARCGIS to add an underscore. Trying to make "ABC11111" look like "ABC_11111". Don't have much experience using Python or VB Script but this is what I have created with ...
2
votes
1answer
139 views

Populating attribute table string field with values from long field using vbScript in ArcGIS Field Calculator?

I want to calculate the field "area_type" with text depending on numbers from the "Value" field. I have tried with the following VB-script in "Field Calculator" but am getting this error message: "...
2
votes
1answer
85 views

Selecting numbers within the slash (/) using ArcMap Field Calculator?

I have date data that I'm separating into three separate fields (all fields are string type, including the input field) by day, month, and year. Unfortunately, the date field is raw data and isn't ...
2
votes
4answers
2k views

VBScript - If/Then Statement - Field Calculator

I am trying to do a simple (or so I thought) if/then statement in the ArcGIS field calculator. I am trying to add the HydroCode field - hydologic soil codes - to an existing data set. I know what the ...
2
votes
1answer
353 views

Field calculation in ArcGIS Desktop?

i have a data which contain a code of area an value of area in shapefile, ex.: area|value 1|33 1|43 1|31 2|12 2|43 3|66 3|76 the question is how to calculate total value per area with arcgis, i ...
2
votes
1answer
1k views

Programatically write values to ArcPad Form control box

Using this blog post I've managed to store user names as global variables in ArcPad. The next step is to use those variables in form 'controls' aka form fields. Per the author's comments under his ...
2
votes
2answers
204 views

Randomly choosing one from multiple fields in Field Calculator of ArcGIS for Desktop?

Using the Field Calculator in ArcGIS for Desktop, I want to randomly choose one field from a list of 10 fields (strings). The Excel equivalent, which is working, is: =INDEX(A2:J2;rnd()*10+1). How ...
2
votes
1answer
3k views

How to combine If Then with InStr in ArcMap field calculator?

I want to write an if then in field calculator that tests if a field in the attribute table contains one of several versions of another string (the versions vary by capitalization). Trouble is, I can'...
2
votes
2answers
157 views

Labeling with two decimal places (rounded) even when second is zero in ArcMap?

I have a benchmark data that need to label. The data where in the field has attribute height like 12.340, 12.400, 13.690. I have to label the height for examples 12.34, 12.40, 13.69.I already used ...
2
votes
0answers
211 views

ArcMap Label Help - Label from X/Y Coordinate

Edited: This picture might help explain my question. Here I have a point at the line with an X/Y coordinate. It also has a leader line to it. This leader line has an X2/Y2 coordinate. Both of ...
2
votes
2answers
94 views

type mismatch: 'esri_8' when using field calculator

I am trying to run the VBScript 'round' function using the field calculator on a column for a numeric field that contains a large number of rows (> 500k). When I run the code on a subset of the field ...