Select to view content in your preferred language

Field Name Alias using the Attachment Relate Info Window Widget 2.2.2

997
10
04-22-2011 11:28 AM
HERSHSINGH
Deactivated User
I have set the alias names in the .mxd of the service but still am having difficulty getting the alias names to show up (instead of the actual field names) in the pop up window.  I do not see any alias tags in the individual config files (IWT_Trees, IWT_Fires, etc.)  Any suggestions?  Thanks!
Tags (2)
0 Kudos
10 Replies
pavankalvala
Emerging Contributor
I have code below to pull field value from a feature selction onto a word document template. Instead of hard coding the field names, I would like to go through config file. How can this be done.

Here is the code below:

Public Overrides Sub OnMouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer)

Dim pMxdoc As IMxDocument
Dim pActiveView As IActiveView
Dim pEnumLayer As IEnumLayer
Dim pLayer As ILayer
Dim pFlayer As IFeatureLayer
Dim pFeatureSelection As IFeatureSelection
Dim pSelectionSet As ISelectionSet
Dim pEnumFeat As IEnumFeature
Dim pEnumFeatSet As IEnumFeatureSetup
Dim pFeat As IFeature
Dim A As Double
Dim B As String
Dim B1 As String

Dim pFeatSel As IFeatureSelection
Dim pMap As IMap
Dim pfeatureclass As IFeatureClass
Dim fields As IFields
Dim C As Long
Dim ii As Long
Dim Field As IField
Dim intFldIndex As Integer
Dim fieldname As String
Dim fieldvalue As Integer
Dim value As String
Dim namelist As String
Dim wdApp As Microsoft.Office.Interop.Word.Application
Dim mydoc As Microsoft.Office.Interop.Word.Document
Dim mywdRange As Microsoft.Office.Interop.Word.Range


pMxdoc = m_application.Document
pActiveView = pMxdoc.FocusMap
pMap = pMxdoc.FocusMap
pFlayer = pMxdoc.SelectedLayer
pfeatureclass = pFlayer.FeatureClass
fields = pfeatureclass.Fields
pFeatureSelection = pFlayer
pSelectionSet = pFeatureSelection.SelectionSet



' Verify that there is at least 1 layer in the TOC
If pMap.LayerCount < 1 Then
MsgBox("Must have at least 1 layer in your map.")
Exit Sub
End If

' verify the name of the selected layer
Dim count As Integer
count = pSelectionSet.Count
If pSelectionSet.Count <> 0 Then
MsgBox("You have have selected: " & pFlayer.Name)
End If

' get the field count
C = fields.FieldCount
MsgBox("There are: " & C & "fields in this layer")

pEnumFeat = pMxdoc.FocusMap.FeatureSelection
'pFeat = pEnumFeat.Next

pEnumFeatSet = pEnumFeat
pEnumFeatSet.AllFields = True
pFeat = pEnumFeat.Next

' loop through each field and add the field name to a list
For ii = 0 To fields.FieldCount - 1
Field = fields.Field(ii)
fieldname = Field.Name ' this gives the field name
value = pFeat.Value(ii).ToString ' this gives the field value
namelist = namelist & fieldname & value & Chr(13)
Next

' diaplay the list of field names in a messagebox
MsgBox(namelist, , "field names and value")


' loop through to get value of FID
Do While (Not pFeat Is Nothing)
A = pFeat.Value(pFeat.Fields.FindField("UFO_ID")) // @@@@ want to get this through config file
B = pFeat.Value(pFeat.Fields.FindField("DATECREATE"))

pFeat = pEnumFeat.Next
'MsgBox(A)
Loop

' opening word doc with the field values inside the word bookmarks
wdApp = New Microsoft.Office.Interop.Word.Application
With wdApp
.Visible = True
.WindowState = WdWindowState.wdWindowStateMaximize
End With

mydoc = wdApp.Documents.Add(Template:="C:\Documents and Settings\ZQ3079\Mobile project\ExportWord(VB)\Audit Form Final.doc")
With mydoc.Bookmarks
.Item("A").Range.InsertAfter(A) ' "A" is bookmark name in word document
.Item("C").Range.InsertAfter(B) ' "C" is bookmark name in word document

End With
End Sub

Let me know.
0 Kudos