ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Code example: VST with duplicate array values removed

The LabelStatus_Code field, with a coded value domain, is used to store the abbreviation option chosen for each annotation feature. The field containing the annotation text string, such as Label_Txt, must have a data type of Text with a length of at least 2,000 characters.

This code example shows the duplicate array values removed in case you are exceeding the 2,000-character limit for the Label_Txt field.

Function Generate([OBJECTID], [OBJECTID_arr], [LABELSTATUS_CODE], [LABELSTATUS_CODE_arr], [PRIMARYNAVAID_CODE], [PRIMARYNAVAID_CODE_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr], [LAT_TXT], [LAT_TXT_arr], [LONG_TXT], [LONG_TXT_arr], [ROLEFIX_CODE], [ROLEFIX_CODE_arr])

VariableArray = Array([LABELSTATUS_CODE_arr], [PRIMARYNAVAID_CODE_arr], [SystemSubtype_arr], [Ident_Txt_arr],
[Frequency_Val_arr],[Channel_Txt_arr], [Voice_Code_arr], [ComponentSubtype_arr], [Name_Txt_arr], [LAT_TXT_arr],
[LONG_TXT_arr], [ROLEFIX_CODE_arr])
k = 0
'Number of arrays 
lVariableCount = UBound(VariableArray) + 1

'Number of records in each array 
firstArray = VariableArray(0)
lRecordsCount = UBound(firstArray ) + 1

do while k < lRecordsCount 
         strOutput = firstArray(k) 
         i = 1 
         do while i < lVariableCount 
                  strOutput = strOutput & "<>"
                  tempArray = VariableArray(i) 
                  strOutput = strOutput & tempArray(k) 
                  i = i + 1 
         loop

'If we already have a string with the same record combination then don't add 
'it again 
if (inStr(strUniqueRecords, strOutput) <> 0) then 
         'Do Nothing 
else 
         'Add this to record array 
         if k > 0 then
                  strRecordsToInclude = strRecordsToInclude & "," & k
                  strUniqueRecords = strUniqueRecords & strOutput & "||" 
         else
                  strRecordsToInclude = k 
                  strUniqueRecords = strOutput & "||" 
         end if 
end if 
k = k + 1 
loop

RecordsToIncludeArray = Split(strRecordsToInclude, ",") 
k = 0
i = 0 
do while k < UBound(VariableArray) + 1 
         tempArray = VariableArray(k) 
         i = 1 
         strOutputText = strOutputText & tempArray(0) 
         do while i < ubound(RecordsToIncludeArray) + 1

                  strOutputText = strOutputText & "<>" 
                  recordId = RecordsToIncludeArray(i) 
                  strOutputText = strOutputText & tempArray(recordId) 
                  i = i + 1 
loop 
 strOutputText = strOutputText & "||" 
    k = k + 1 
loop 

Generate = strOutputText 
End Function

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2020 Esri. | Privacy | Legal