English

How To: Get information returned by IDENTIFY in a layout or view

Procedure

Summary

Scripts to get the information returned by the IDENTIFY tool button into a table to use in a layout or a view.

Procedure

1. Open a New Script window
2. Copy this script into the new window:

Code:
'--- Script 1
'-- LIS.OwnRpt
'-- Creates a report of ownership for the currently selected
'-- records in the parcel theme

theView = av.GetActiveDoc
theTheme = theView.GetActiveThemes.Get(0)
theVtab = theTheme.GetFTab
theFieldsList = theVtab.GetFields

theVList = {}
for each F in theFieldsList
if(F.IsVisible) then
theVList.Add(F.AsString)
end
end

'-- Edit the pathname in the next line as appropriate
theWFile = FileDialog.Put("c:\windows\owner.rpt".AsFileName, "*.rpt".AsPattern,
"Report File")
if (theWFile = nil) then
exit
end

'-- Add the fields to be written to the file, to a list
'-- Edit the names in parentheses to match the items in your tables
theGoodFields = {}
theGoodFields.Add("Re_")
theGoodFields.Add("Owner1")
theGoodFields.Add("Owner2")
theGoodFields.Add("O-Address")
theGoodFields.Add("O-city")
theGoodFields.Add("O-state")
theGoodFields.Add("O-zip")
theGoodFields.Add("S-address")

'-- Edit the title in the next line to fit your needs
theTitle = MsgBox.Input("Please Enter a Title for the Report", "Enter Title",
"Parcel Ownership Report")
theDate = Date.Now.SetFormat("MM/dd/yyyy")

theRptList = {}
for each rec in theVtab.GetSelection
for each f in theVTab.GetFields
str = theVTab.ReturnValue(f, rec)
if (theGoodFields.FindByValue(f.AsString) <> -1) then
theRptList = theRptList.Add(f.AsString++" = "++str.AsString)
'-- adds a space between records in the report
if (f.AsString = "S-address") then
theRptList = theRptList.Add(" ")
end
end
end
end

lf = LineFile.Make(theWFile, #FILE_PERM_WRITE)
lf.GoToBeg
lf.WriteElt(theTitle++tab++tab++theDate.AsString)
lf.WriteElt(nl)
lf.Write(theRptList, theRptList.Count)
lf.Close

av.ShowMsg("Report written to"++theWFile.AsString)

'--- End of Script 1

3. Edit the script as per its comments
4. Compile the script
5. Rename script to 'Identify1' or other suitable name
6. Load script as a tool button
7. Select the features from the view using the 'Select Feature' tool button
8. Select the 'Identify1' tool button
9. Click the view
A table will be created and store in the designated file location (Example: C:\bob\table.rpt).
10. Open a New Script window
11. Copy this script into the new window

Code:
'--- Script 2
'--- LIS.TextFile
'-- Writes the selected file onto a Layout in the
'-- rectangle selected by the user.

theLayout = av.GetActiveDoc
if (theLayout.GetGraphics.EditText.Not) then
userRect = theLayout.GetDisplay.ReturnUserRect
theRFileName = FileDialog.Show("*.*", "All Files", "Get File")
if (theRFileName = nil) then exit end

txtsym = TextSymbol.Make
txtsym.SetFont(Font.Make("Arial", "Normal"))
txtsym.SetSize(12)

theRFile = TextFile.Make(theRFileName, #FILE_PERM_READ)
theString = theRFile.Read(theRFile.GetSize)
t = GraphicText.Make(theString, userRect.ReturnOrigin)
t.SetDisplay(theLayout.GetDisplay)
theLayout.GetGraphics.UnselectAll
t.SetSelected(TRUE)
theLayout.GetGraphics.AddName(t)
t.SetBounds(userRect)
t.SetSymbols({txtsym})
t.SetSelected(FALSE)
end

'--- End of Script 2

You don't need to edit this script.
11. Compile the script
12. Rename script to 'Identify2' or other suitable name
13. Load script as a tool button in the layout or view GUI
14. Select the 'Identify2' tool button
15. Use the cursor to draw a rectangle in the layout or view for the table to be drawn in
16. Select the file to be placed in the rectangle
The information similar to IDENTIFY tool will be added to the layout or
view.

Related Information