English

How To: Print selected records from a table

Summary

This article shows how to print only the selected records of a table using an Avenue script.

Procedure

  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Copy the following code into the new window:

    Code:
    theTable = av.getactivedoc
    theTable.PromoteSelection
    theVtab = theTable.GetVtab
    thebitmap = theVtab.getselection
    theCount = theBitMap.Count
    theNewVtab = theVtab.Export("Temp.dbf".asFileName, DBASE, TRUE)
    theNewTable = Table.Make(theNewVtab).setname("Query Results")
    TheDoc = av.GetProject.finddoc("Query Results")
    TheDoc.GetWin.Open
    ThePrint = TRUE
    ThePrint = MsgBox.YesNo("Would You Like To print The Table?", "Info", True)
    If (ThePrint) then
    d = av.GetActiveDoc
    if (0 <= Printer.The.Edit({d.GetName})) then
    av.ShowMsg("Printing "+d.GetName+"...")
    av.UseWaitCursor
    System.RefreshWindows
    d.Print
    av.ShowMsg("")
    end
    end
    av.getProject.RemoveDoc(TheDoc)

  3. Attach the script to a button on the Table GUI.

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. Select Table under the Type dropdown on the Customize dialog.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Enter the name of the script in the Script Manager and click Select.
    I. Close the Customize dialog box.

    For more information, see 'Customize dialog box' in ArcView Help.

  4. Open the table and select records to print.
  5. Click the new button.