6
votes
Accepted
Stationing Callouts using VBScript Labeling in ArcMap?
Subtract the INT([MEASURE]/100) value, multiplied by 100, from the MEASURE to leave the remaining 98.28
Use Advanced label expression
Function FindLabel ( [MEASURE] )
DIM leftval, rightval
leftval ...
6
votes
Accepted
Conditionally labeling layer based on three fields
I'm not familiar with VB, but the following Python may do what you're after (with the 'Advanced' checkbox ON, and assuming a Shapefile where NULLs are not possible):
def FindLabel ( [conductor_a], [...
4
votes
How do I add a space in a label with vbscript?
Something like this would work:
[Field_1]&" "&[Field_2]&" "&[Field_3]
or this (as long as all of your fields are strings):
[Field_1]+" "+[Field_2]+" "+[Field_3]
4
votes
Adding two to every value of field using ArcMap Field Calculator
If your values are all in a field called SECTION and you want all these values to be increased by 2:
Start an Edit Session (means you can Undo after running Field Calculator if it doesn't do what you ...
3
votes
Conditionally labeling layer based on three fields
This may work as well:
def FindLabel ( [conductor_a], [conductor_b], [conductor_c] ):
return [conductor_a] or [conductor_b] or [conductor_c] or "ANY VALUE IF ALL PRIOR FIELDS ARE EMPTY"
3
votes
Using field calculator if statement to update another field using another field's values?
I think what is happening here is that you have entered all your worflow in the pre-logic script and then told the calculator that RD_BASELINE.CLASS_MMS=RD_BASELINE.CLASS_MMS, which doesn't mean ...
2
votes
If-Then Label Expression
Function FindLabel ( [NAME], [Label] )
if ( [Label] = 1) then
FindLabel =( [NAME])
end if
End Function
VB parser
2
votes
Converting 5 digit serial date to mm/dd/yyyy using VBScript in ArcMap Field Calculator?
An alternative..Definitely not as eloquent.. but it's what I came up with to solve the same issue.. using Field Calculator and the following expression in python.
def convExcelDate(inp):
inp = ...
2
votes
Splitting (stacking) labels in ArcMap in multiple lines using vbScript?
You could probably write a vb expression to replace every second comma, but I find it easier to work in python. Something like this would work:
def FindLabel([LABELFIELD]):
labels = map(str.strip,...
2
votes
Modifying text with tags in If Then Else in VBScript Label Expressions
The problem is to do with your "< 1", you have used a < symbol which if you think about it is the opening character of any of your html font tags. So you've essentially opened a tag, not said ...
2
votes
Accepted
Forcing label text into one line using ArcGIS Pro
Go to fitting strategy and untick Stack labels.
2
votes
Using Field Calculator in ArcMap
This is entirely due to the syntax of the programming language you are using (in this case VB Script, but it is much the same for other - eg, in Python, you can use either " or ').
The value that ...
1
vote
Accepted
What VBScript can I use to populate a field with text using the ArcGIS field calculator?
if you're trying to update all values of a string field to say something, just right-click the field and go to field calculator and type "something" into the input box. Ignore the codeblock ...
1
vote
ArcGIS Field Calculater DateAdd() gives Expected end of statement error
When using VBScript, do not specify the variable type. Instead of
dim TS_seconds as date
simply use
dim TS_seconds
1
vote
Calculating median in grouped data using ArcMap
I think this should work,
def grouped_data_median(t_14, t_15_64, t_65):
# total number values
n = t_14 + t_15_64 + t_65
# median lower bound
mlb = None
# groups cumulative ...
1
vote
VBscript to change label only for certain values
Solution:
Function FindLabel ( [ID_Messpkt], [Pb_corr] )
FindLabel = [ID_Messpkt]& vbNewLine &[Pb_corr]
if ([Pb_corr] = 49) then
FindLabel = "<50"
end if
End Function
1
vote
Using field calculator to populate one column using other data in same table in ArcMap
Use double-quote mark " instead of single-quote ' around your text, and put the colon : inside the quote. Also you're missing an ampersand & between "Name:" and [name]
"Name:" & [name] & ...
1
vote
Travel entire streets segments
I see two possible sources of errors:
Edges do not have turn angle, turns do.
So, a=Turn.Angle will receive invalid values, if so.
Any value used in the pre-logic script code must be passed as a ...
1
vote
Including rotated label alongside stacked label in ArcMap?
Instead of combining multiple attributes in a single label, you can Create Classes for each attribute by changing the "method" Dropdown.
You can then position each label separately, ...
1
vote
Accepted
Basing an 'ELSIF' expression on several fields
Based off your current code, you could try something like this. It assumes that only one value from A, B, C, or N will be written out. As noted in my comment above, the only time the N value will be ...
1
vote
Using "Elseif" "OR" "And" statement to create label from two fields
You just have to add the "Construction Status" field in the Function FindLabel then create a "b" variable that you fill using the same logic you used for your "a" variable and change the FindLabel = a ...
1
vote
Inputting formatted concatenate in field of attribute using ArcGIS Desktop?
You can also use the UpdateCursor in the Python window of ArcMap:
import arcpy
fc = r"C:\data.gdb\feature" #Change
hundreds = (i for i in range(0,1000000,100)) #Generator which yields 0,100,200,...,...
1
vote
Inputting formatted concatenate in field of attribute using ArcGIS Desktop?
It's not clear if you're trying to do this in a script or from the field calculator; for my example I have added a field called Name_Seq (10 character limit in a shapefile):
Assuming this is what you ...
1
vote
What's wrong with this VBscript in field calculator - ArcGIS?
Your vba syntax is incorrect. An elseif requires you to specify the if part eg
If [Value] = '1' Then
val = '1'
ElseIf [Value] = '2' Then
val = '2'
Else val = '3'
End If
If you're only ...
1
vote
Accepted
Using VBScript for advanced labeling in ArcMap?
The script would look something like this
Function FindLabel ( [Sample_ID], [ALABEL], [BLABEL], [CLABEL],[DLABEL] )
dim label
label = "<FNT name= 'Arial' size='10'><BOL>" & [...
1
vote
Accepted
If/Then Statement with LIKE using the Field Calculator
There is no LIKE comparison operator in VB Script (see link).
You could use InStr to check if some search text appears somewhere in the input string:
dim y
If InStr([Categories], "Orange") Then
y ...
1
vote
Splitting (stacking) labels in ArcMap in multiple lines using vbScript?
The ArcGIS Desktop help on Building label expressions explains how to use vbScript to:
Create stacked text. For example, this expression creates a label with
the Name field and the two address ...
1
vote
Accepted
ArcMap Python script for attribute split, replace and concatenate
This is a relatively trivial find and replace problem.
In your shapefile add the new text field (what you are calling
RAIDETUNN).
Run the field calculate tool on your new field, add into the code ...
1
vote
Accepted
How to create a directory in Scripter Automation
Try using md $path -Force, per this resource Weekend Scripter: Use PowerShell to Create Folder
1
vote
Accepted
if-then statement using VBscript not working
The syntax you have to use with if..then is like this
dim y
if [PR_TBS] <= 100 then
y = "< 101 Ton"
elseif [PR_TBS] <= 200 then
y = "101-200 Ton"
elseif [PR_TBS] <= 300 then
y = "...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
vbscript × 184arcgis-desktop × 134
field-calculator × 76
labeling × 56
arcmap × 37
python-parser × 23
python × 20
arcgis-10.2 × 16
arcpad × 16
arcgis-10.0 × 15
arcgis-10.1 × 7
arcobjects × 7
expression × 7
attribute-table × 6
modelbuilder × 6
arcgis-10.4 × 6
arcpy × 5
string × 5
vba × 5
if-statement × 5
javascript × 4
fields-attributes × 4
date × 4
vb.net × 4
hyperlink × 4