I am writing a standalone mobile application that consume the mapcache data to a map viewer in Version 10.2.2
I want to create a search tool that contains a combo-box which I want to auto-populate it with the values of the layer's field domain.
How do I obtain the domain codes and values of a field with the MapLayers.
Solved! Go to Solution.
Private Sub Get_Street_Names_From_Domain()
'
' --- Get Code and Street name from Street layer
'
Try
'
' --- Street layer - Get Street Domain
'
Dim pSource As FeatureSource = VectorMobileCache.FeatureSources(g_Street_LP)
pSearchSource = pSource
'
Dim pDomain As IDomain
pDomain = pSource.Columns("STR_CODE").GetDomain(0)
Dim pSW As Workspace = pSource.Workspace
Dim pCV As CodedValueDomain = CType(pDomain, CodedValueDomain)
'
' --- Get count
'
gStreetArrayCount = pCV.Rows.Count
'
' --- If count is greater than zero
'
If gStreetArrayCount > 0 Then
'
Dim i As Integer
'
' --- Loop thru rows to get code and street name
'
For i = 0 To gStreetArrayCount - 1
gStreetArray(0, i) = pCV.Rows(i).Item(0) 'Code
gStreetArray(1, i) = pCV.Rows(i).Item(1) 'Description
gStreetArray(2, i) = UCase(pCV.Rows(i).Item(1)) 'Description in upper case
Next I
Else
MessageBox.Show("Problems obtaining Street Names domain.", "Street Domain - Error",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
'
Catch ex As Exception
g_ErrorMessage = " - Viewer - Problems obtaining Street Names domain: " & ex.Message.ToString
WriteLog(g_ErrorMessage)
'
MessageBox.Show("Problems obtaining Street Names domain.", "Street Domain - Error",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
'___________________________________________________________________________________
Private Sub Get_Street_Names_From_Domain()
'
' --- Get Code and Street name from Street layer
'
Try
'
' --- Street layer - Get Street Domain
'
Dim pSource As FeatureSource = VectorMobileCache.FeatureSources(g_Street_LP)
pSearchSource = pSource
'
Dim pDomain As IDomain
pDomain = pSource.Columns("STR_CODE").GetDomain(0)
Dim pSW As Workspace = pSource.Workspace
Dim pCV As CodedValueDomain = CType(pDomain, CodedValueDomain)
'
' --- Get count
'
gStreetArrayCount = pCV.Rows.Count
'
' --- If count is greater than zero
'
If gStreetArrayCount > 0 Then
'
Dim i As Integer
'
' --- Loop thru rows to get code and street name
'
For i = 0 To gStreetArrayCount - 1
gStreetArray(0, i) = pCV.Rows(i).Item(0) 'Code
gStreetArray(1, i) = pCV.Rows(i).Item(1) 'Description
gStreetArray(2, i) = UCase(pCV.Rows(i).Item(1)) 'Description in upper case
Next I
Else
MessageBox.Show("Problems obtaining Street Names domain.", "Street Domain - Error",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
'
Catch ex As Exception
g_ErrorMessage = " - Viewer - Problems obtaining Street Names domain: " & ex.Message.ToString
WriteLog(g_ErrorMessage)
'
MessageBox.Show("Problems obtaining Street Names domain.", "Street Domain - Error",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
'___________________________________________________________________________________