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. This field 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 LabelStatus_Code 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
9/30/2010