Msj Databasev7 1

download Msj Databasev7 1

of 54

Transcript of Msj Databasev7 1

  • 8/3/2019 Msj Databasev7 1

    1/54

    MicroStation/J Tutorial Workbook 13-1

    13 Creating Database LinkagesThis tutorial serves as an introduction to attaching database linkages to elements inMicroStation/J.

    PreviewWithin this tutorial are exercises to help you learn about:

    Establishing a database linkage between an element and arow in the database.

    Defining the Active Entity graphically.

    Establishing database linkages to fenced elements.

    Todo thistutorialyoumusthavepreviouslyperformedtheproceduresinSettingUpfortheDatabaseInterfaceinChapter4intheAdministratorsGuidefor setting up the database for MicroStation/J, setting upMicroStation/J for the database, and connecting to the database fromwithin MicroStation/J.

    Prepare for the first exercises

    1. Open the design file cd9.dgn, which is located in MicroStation/JsWorkspace/projects/tutorials/intro/dgn directory.

    This file is installed when you select the database utilities wheninstalling MicroStation/J on your system.

    2. Turn off all views except 1 and 2.

    3. From the Window menu, choose Tile.

    4. Use the Fit Viewview control to fit views 1 and 2.

    5. In View 2, use theWindow Areaview control to magnify the displayof the lower left parcel of land.

    314_dbif.fra Page 1 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    2/54

    13

    13-2 MicroStation/J Tutorial Workbook

    Creating Database LinkagesEstablishing a database linkage

    6. From the File menu, choose Save Settings (or press ).

    Views 1 and 2 set up for the first exercises.

    With the views set up, the next step is to connect to the database. Thisprocedure will vary depending on your setup. Typically, it can be doneusing a string that was defined in the setting up procedures.

    Connect to the database

    1. From the Settings menus Database sub-menu, choose Connect.

    The Connect to Database dialog box opens.

    2. From the Database Server option menu, choose the database serverthat you wish to use, such as ODBC.

    3. In the Connect String field:

    key in the string that you defined in the setting up procedures.

    OR

    key in *, to select the data source.

    4. Click OK.

    Connect to Database dialog box.

    Establishing a database linkage

    The design file (cd9.dgn) contains a sectional map of a suburban area.The centroid of each parcel is marked by a cyan (light blue) dot. Each dot

    314_dbif.fra Page 2 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    3/54

    Creating Database LinkagesEstablishing a database linkage

    MicroStation/J Tutorial Workbook 13-3

    isactuallyapoint(zerolengthlineelement),whichhasaheavylineweight

    for easy visibility. Parcel outlines are indicated by grey lines. This designfilecontainsdatabaselinks.Forexample,eachcentroiddothasadatabaseattribute, which can be reviewed.

    Review the database attribute for parcel number 10

    1. From the Tools menu choose Database.

    The Database tool box opens.

    2. In the Database tool box, select the Review Database Attributes ofElementtool.

    3. In View 2, identify the cyan centroid dot for parcel number 10.

    The dot highlights.

    4. Accept.

    The SQL Window opens, displaying the database attribute.

    5. Use the scroll bar, and/or the Next button to review all the databaseattributes attached to the element.

    SQL Window displaying the database attributes attached to Parcel 10.

    Establishing linkages to an SQL database is as simple as querying thedatabase. MicroStation/J uses a seedrow called theActiveEntityto

    insert values into a special table namedAE. This seed row can be copiedfrom an existing row in the database or you can create it directly. TheActive Entity can be edited from within MicroStation/J before it is linkedto an element.

    314_dbif.fra Page 3 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    4/54

    13

    13-4 MicroStation/J Tutorial Workbook

    Creating Database LinkagesEstablishing a database linkage

    Before continuing, the Linkage Mode should be checked and, if

    necessary, set to New.

    Check the Linkage Mode setting

    1. In the Database tool box, select the Show Linkage Modetool.

    The linkage mode displays in the status bar.

    If the linkage mode displayed is not New then it must be changed.

    If necessary, change the linkage mode to New

    1. From the Settings menu, choose Database > Dialog.

    The Database settings box opens.

    2. From the Linkage Mode option menu, choose New.

    3. Close the Database settings box.

    Defining the Active Entity

    One way to define the Active Entity is with the ACTIVE ENTITY (AE=)key-in, which includes an SQL INSERT statement.

    Define the Active Entity as a seed row for theparceltable withan attribute value forowner

    1. In the Key-in Window, key in:

    AE= insert into parcel (owner) values ('John Smith')

    (Press to complete the operation.)

    This does not insert a row in parcel, rather it inserts a row in the ActiveEntity table with the structure of parcel and an owner value of JohnSmith.

    314_dbif.fra Page 4 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    5/54

    Creating Database LinkagesDefining the Active Entity

    MicroStation/J Tutorial Workbook 13-5

    Confirm the creation of the Active Entity

    1. In the Database tool box, select the Show Active Entitytool.

    The SQL Window shows the seed row forparcel. All values in theAE table are empty except those specified in the AE= key-in.

    This valuecan be linked to any parcel in the parcel table. For this exercise,we will link it to the lower left parcel (number 10), displayed in View 2.

    Establish a linkage from parcel number 10 to theparcel table

    1. In the Database tool box, select the Attach Active Entitytool.

    2. In View 2, identify the cyan centroid dot for parcel number 10.

    The centroid dot for the parcel highlights.

    3. Accept the parcel.

    The linkage is established.

    When you attach a linkage to an element, two values are saved with theelement. One is an entity number that uniquely identifies the table in thedatabase. The other value ismslink that relates the element to a specificrow in the table.

    Review the linkages between the parcel table and the parcel

    1. In the Database tool box, select the Review Database Attributes ofElementtool.

    2. In View 2, identify the centroid dot for parcel number 10.

    3. Accept the parcel.

    TheSQLWindowdisplaysthesamelinkageasseenpreviously.Clickthe Next button to retrieve successive linkages.

    The linkage you just established is the last one. Notice themslinkkey value was replaced with a unique number for MicroStation/Js

    314_dbif.fra Page 5 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    6/54

    13

    13-6 MicroStation/J Tutorial Workbook

    Creating Database LinkagesEstablishing a database linkage

    use. MicroStation/J uses themslinkkey to access information in the

    database.

    SQL Window displaying the just attached database linkage

    WhentheAttach ActiveEntitytoolisusedinNewlinkagemode,asabove,the Active Entity is copied into the primary database table (parcelin thisexample), thereby creating a unique linkage to that row. The ACTIVEENTITY (AE=) key-in works only in New linkage mode; it does notrequire an existing seed row in the table.

    Defining the Active Entity graphically

    YoucanusetheDefineActiveEntityGraphicallytooltosettheActiveEntitydefinition to match an existing database row. The Active Entity assumesall database attributes of the element to which the row is linked. In thefollowingexample you will firstplacea textelement. Youwill then locatean Active Entity graphically and attach a linkage to the new text element.

    Prepare for the exercise

    1. In View 2, use the View controls to select a blank area in the designplane.

    2. In the Main tool box, select the Place Texttool

    3. Place some text in View 2.

    4. If necessary, use the View controls to magnify the text so that it isvisible.

    5. In View 1, use theWindow Areaview control to magnify part of the

    subdivision, to display several parcels.This will make it easier to identify centroid points of several parcels.

    314_dbif.fra Page 6 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    7/54

    Creating Database LinkagesEstablishing database linkages to fenced elements

    MicroStation/J Tutorial Workbook 13-7

    Set the Active Entity graphically

    1. In the Database tool box, select theDefine Active Entity Graphicallytool.

    2. In View 1, identify any parcel on its centroid.

    3. Accept the parcel.

    If Confirm Rows is off in the Database settings box, the first rowlinked to the element is set as the Active Entity.

    If Confirm Rows is on, the first row is displayed in the SQL Window.If there is more than one linked row, you can click the Next buttonto reject rows. To accept a row as the Active Entity, click the Acceptbutton. To return to step 2, click the Stop button.

    4. Use theShow Active Entitytool to display the new Active Entity in the

    SQL Window.

    Link the Active Entity to the text element

    1. In the Database tool box, select the Attach Active Entitytool.

    2. In View 2, identify the text element.

    The text highlights.

    3. Accept the text element.

    If Linkage Mode is set to Duplicate in the Database settings box, thetext element is linked to the same row as the parcel centroid. IfLinkage Mode is set to New, a new row is created in the table and thelinkage is to that row.

    4. UsetheReviewDatabaseAttributesofElementtooltoexaminethenewlinkage to the text element. It should match the Active Entityattributes exactly.

    Establishing database linkages to fenced elements

    YoucanusetheAttachActiveEntitytoFenceContentstooltolinktheActiveEntity to each element contained in a fence.

    If Linkage Mode is set to New, the Active Entity is used as a templatefor attribute information and a new row is inserted in the database foreach element contained in the fence. This tool is useful for quicklyentering groups of attributes into the database. This is especially usefulwith designs that have many of the same parts.

    If Linkage Mode is set to Duplicate, all elements contained in the fenceare linked to an existing row in the table, as selected for the Active Entity.

    314_dbif.fra Page 7 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    8/54

    13

    13-8 MicroStation/J Tutorial Workbook

    Creating Database LinkagesEstablishing a database linkage

    Prepare for the exercise

    1. Use theShow Linkage Modetool to check that the linkage mode is setto New.

    The current linkage mode appears in the status bar.

    2. If necessary, select Settings > Database > Dialog to open theDatabase settings box, and set Linkage Mode to New.

    3. InView2,useelementplacementtoolssuchasPlaceBlock,andPlaceCircle, to place several elements in a blank area of the design plane.

    You will now attach the active entity to all of these elements.

    Establish new linkages to the elements just placed

    1.In View 2, use the

    Place Fencetool to place a fence around the newelements.

    2. In the Database tool box, select the Attach Active Entitytool.

    3. In the tool settings, turn on Use Fence.

    4. If necessary, from the tool settings Fence option menu, chooseInside.

    5. Accept the fence contents.

    All elements in the fence are linked to the parcel table with theattributes specified in the Active Entity.

    6. UsetheReviewDatabaseAttributesofElementtooltoexaminethenewlinkages to the elements.

    Themslinkkey indicates each element is linked to a different row.This is becausethe linkages were established with Linkage Mode setto New.

    Detaching database linkages

    YoucanusetheDetachDatabaseLinkagetooltoremovelinkagesbetweenthe database and the elements in the design file. You can do this toindividual elements, or to a group within a fence.

    Detach the database linkage to a single element

    1. In the Database tool box, select theDetach Database Linkagetool.

    2. Identify one of the elements placed in the previous exercise.

    The element highlights.

    3. Accept.

    The database linkage is detached.

    314_dbif.fra Page 8 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    9/54

    Creating Database LinkagesWorking with Database Linkages

    MicroStation/J Tutorial Workbook 13-9

    Ifyouagaintrytoidentifythiselement,usingtheDetachDatabaseLinkage

    tool, it will not highlight because there is no linkage. Now, use a fence todetach the linkages from the remaining elements.

    Use a fence to detach database linkages

    1. In the Main tool box, select the Place Fencetool.

    2. In View 2, place a fence around all the elements that you placed forthe previous exercise, plus the text that you placed earlier.

    3. In the Database tool box, select theDetach Database Linkagetool.

    4. In the tool settings, turn on Use Fence and set the option menu toInside.

    5. Accept, to detach all linkages within the fence.

    To ready the design file up for the next exercises, delete the elements andtext that you placed for the previous exercises.

    Tothispoint,youhavebeenworkingwithdatabaselinkages toelements,using only thetools in the Database tool box. In the following section youwill be introduced to the Visual SQL Query Builder, from which you canperform similar operations, while querying the database.

    Working with Database Linkages

    Given a design that contains elements to which rows in a database table

    areattached,youcangraphicallyquerythedatabaseanddisplayattributesin the design. You can do this via SQL statements. These may be enteredmanually in the SQL Window, but this requires that you know the syntaxfor SQL statements, plus the tables that are present in the database. Forgeneral queries, a much simpler method is to use the Visual SQL QueryBuilder dialog box. Using this dialog box, you can:

    Query the database.

    Create, save and reuse queries.

    Create and edit data entry forms.

    Attach/detach linkages to graphical elements.

    Locate elements that are attached to the currently displayed record.

    In the following exercise, you will briefly look at the SQL Window.Following this you will use the Visual SQL Query Builder dialog box toperform a number of database operations.

    314_dbif.fra Page 9 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    10/54

    13

    13-10 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    Prepare for the exercise

    1. If necessary, re-open the design file cd9.dgn and connect to thesample gis database.

    2. Maximize View 1.

    3. Turn off all other views.

    4. Use the Fit Viewview control to fit View 1.

    The SQL Window

    You can query the database with SQL statements entered in the SQLWindow. To do this you must know the syntax, the tables and thecolumnsthatarepresentinthedatabase.Forthisexerciseyouwillrequest

    a list of all owners, plus their parcel numbers.

    (If necessary) Open the SQL Window

    1. In the key-in window, key in SQL.

    The SQL window opens.

    Thiswindowisdividedintotwosections,thelowerbeingthekey-inarea.Information retrieved from the database displays in the upper section.

    Manually query the database

    1. In the key-in section of the SQL Window, key in:

    SELECT parcel_no, owner, parc_value FROM parcel

    314_dbif.fra Page 10 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    11/54

  • 8/3/2019 Msj Databasev7 1

    12/54

    13

    13-12 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    Prepare for the exercise

    1. Close the SQL Window.

    2. From the Settings menus Database sub-menu, choose QueryBuilder.

    The Visual SQL Query Builder dialog box opens.

    The Visual SQL Query Builder dialog box.

    3. From the dialog boxs Setting menu, choose Forms.

    The Standard Form Items dialog box opens.

    4. If necessary, turn on any entries that are not currentlychecked.

    5. Click OK.

    The Standard Forms dialog box closes and focus returns tothe Visual SQL Query Builder dialog box.

    Using the Visual SQL Query Builder dialog box, you will buildthe required SQL statement.

    314_dbif.fra Page 12 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    13/54

    Creating Database LinkagesVisual SQL Query Builder

    MicroStation/J Tutorial Workbook 13-13

    Create the SQL statement with the Visual SQL Query Builder

    1. Click the Tables button.

    The Select Table dialog box opens.

    2. In the Select Table dialog box, double-click parcel.

    The parcel table list box opens in the Visual SQL Builder dialogbox.Simultaneously, the beginningof the SQL statement appears inthe SQL Select Statement area.

    3. Click Close in the Select Table dialog box.

    4. In the parcel list box double-click on parcel_no.

    In the list box, parcel_nohighlights and the SQL Select Statementupdates to include the selection.

    314_dbif.fra Page 13 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    14/54

    13

    13-14 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    5. Similarly, double-click onowner, andparc_value (scroll down to

    see parc_value).Theselectionshighlight and againtheSQL Select Statement updatesto include the selections.

    The Visual SQL Query Builder dialog box, showing the SQL Select Statement.

    With the SQL statement completed, you are ready to execute it.

    Execute the SQL statement

    1. If necessary, in the Visual SQL Query Builder dialog box, turn onDataset Mode, and Execute Query on Open.

    2. Click the Execute button.

    The parcel form displays. Notice that only those values that yourequested are displayed in the form.

    314_dbif.fra Page 14 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    15/54

  • 8/3/2019 Msj Databasev7 1

    16/54

    13

    13-16 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    Selectonlythoseparcelsthatarevaluedbetween$100,000and

    $200,000 (inclusive)1. In the Visual SQL Query Builder dialog box, click the Where tab.

    2. In the Available Fields list, select parc_value.

    parc_value appears in the Where Fields column.

    3. Click the >= button.

    >= appears in the Operator column.

    4. In the Value field, key in 100000.

    5. Click the And button.

    The value 100000 appears in the Value column and the wordAND appears in the And/Or column.

    6. In the Available Fields list, again select parc_value.parc_valueappears on the second line in the Where Fields column.

    7. Click the

  • 8/3/2019 Msj Databasev7 1

    17/54

    Creating Database LinkagesVisual SQL Query Builder

    MicroStation/J Tutorial Workbook 13-17

    Change the OrderBy clause

    1. In the Visual SQL Query Builder dialog box, click the OrderBytab.

    2. In the Available Fields list, select parc_value.

    3. Click Apply.

    The SQL Select Statement updates, with the ORDER BY clausechanged to parc_value.

    4. Click Execute.

    A second parcel form appears.

    Notice that this second form reports that the total number of recordsmeeting the new search criteria is much less than that in the first form.

    The second form is reporting only on those parcels that have a valuebetween $100,000 and $200,000 inclusive. Also, note that the data in thesecond form is presented in order of parcel values.

    Querying via a form

    Youcan use theformscreatedinqueries toperformadditional queries onthe database.

    Prepare for the exercise

    1. Minimize the Visual SQL Query Builder dialog box.

    2. Close one of the parcel forms.

    Using the form, you can enter an SQL statement in the Query field.Alternatively, you can enter new values directly in the data fields. Forexample, you will now search for all parcels with a value above $150,000dollars.

    Query the database via the form

    1. In the parcel form, click the Clear button.

    2. In the parc_value field, key in >150000.

    3. In the form, click Query.

    The form updates to display the first record of the data meeting thenew criteria.

    Adding SQL clauses manuallyYou can add clauses manually to the SQL Select Statement in the VisualSQL Query Builder dialog box. For example, you can query the databasefor the cost per square foot of each parcel.

    314_dbif.fra Page 17 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    18/54

    13

    13-18 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    Prepare for the exercise

    1. Close the parcel form.

    2. Re-open the Visual SQL Query Builder dialog box (select Window >Visual SQL Query Builder).

    3. In the SQL Select Statement input area, following the clauseSELECT parcel_no,owner,parc_value, add the following:

    ,parc_value/parc_area

    (note the comma at the beginning of the addition to the clause).

    4. Click Execute.

    The parcel form appears, with the new field displayed, showing thecalculated value of $/squ.ft.

    Saving queries and forms

    Where you may have use for a query in the future, you can save it to disk.Similarly, you can save forms to disk.

    314_dbif.fra Page 18 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    19/54

    Creating Database LinkagesWorking with a form dialog

    MicroStation/J Tutorial Workbook 13-19

    Save the query and form to disk

    1. From the Visual SQL Query Builder dialog boxs Queries menu,choose Save As.

    The Save SQL Query To dialog box opens. By default it opens in theBentley\Workspace\system\data directory.

    2. In the Files field, enter values.

    3. Click OK.

    By default, the extension .sql is added to the file name.

    4. From the Visual SQL Query Builder dialog boxs Forms menu,choose Save As.

    The Save Form dialog box opens. By default it opens in theBentley\Workspace\system\data directory.

    5. In the Files field, enter values.

    6. Click OK.

    By default, the extension .rsc is added to the file name.

    7. Close both the Visual SQL Query Builder dialog box and the parcelform.

    Working with a form dialog

    Earlier, you used tools from the Database tool box to query the database,by identifying graphical elements in the design file. You can performmany of these tasks using buttons on query forms. When you use the

    button on the form, only data that is part of the form is displayed.

    Prepare for the exercise

    1. If necessary, re-open the design file cd9.dgn and connect to thesample gis database.

    2. If necessary, open the Database tool box.

    3. Maximize View 1.

    4. Turn off all other views.

    5. Use the Fit Viewview control to fit View 1.

    314_dbif.fra Page 19 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    20/54

    13

    13-20 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    6. Use theWindow Areaview control to magnify the lower right group

    of parcels.

    View 1 showing the lower right group of parcels

    You will use this group of parcels to explore the functions available in theform that you created earlier. First, you will use the Review DatabaseAttributes of Elementtool to retrieve information about a parcel.

    Review information about parcel number 34

    1. In the Database tool box, select the Review Database Attributes ofElementtool.

    2. Identify the centroid (cyan dot) of parcel number 34.

    The cyan dot highlights.

    3. Accept.The SQL Window opens, displaying the database attributesassociated with the graphical element.

    SQL Window displaying all database attributes

    314_dbif.fra Page 20 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    21/54

    Creating Database LinkagesWorking with a form dialog

    MicroStation/J Tutorial Workbook 13-21

    UsingtheReviewDatabaseAttributesofElementtoolretrievesalldatabase

    attributes for the selected element. Using the query form, you can reviewonly that data that you want to see.

    Open the saved form

    1. Close the SQL Window.

    2. From the Settings menus Database sub-menu, choose QueryBuilder.

    3. In the Visual SQL Query Builder dialog box, from the Forms menu,choose Open.

    The Open Form dialog box opens.

    4. From the list of files, choose values.rsc.

    5. Click OK.The parcel form opens.

    6. Minimize the Visual SQL Query Builder dialog box.

    Review information about parcel number 34

    1. In the parcel form, click Review.

    2. Identify the centroid (cyan dot) of parcel number 34.

    The cyan dot highlights.

    3. Accept.

    The form updates with the information relevant to the selectedparcel.

    The parcel form displaying the database attributes of parcel number 34.

    Similarly,the Attach and Detach buttons provide equivalentfunctions totheAttachActiveEntityandDetachDatabaseLinkagetoolsintheDatabase

    314_dbif.fra Page 21 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    22/54

    13

    13-22 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    tool box. The Attach button uses the displayed database information as

    the Active Entity. A fourth button in this group Locate lets youfind the element to which the database attributes are attached.These include graphical elements, text strings, and text nodes, asthe following exercise illustrates.

    Prepare for the exercise

    1. Turn on View 2.

    2. Resize and reposition View 2 to the top left portion of thescreen (refer to diagram following).

    3. Position the parcel form at the upper right region of thescreen.

    This will leave parcels 34 - 37 displayed in the lower right

    region of View 1.

    4. Use the Fit Viewview control to fit View 2.

    View 2 will be used in the location process.

    5. From the Settings menu, choose View Attributes.

    The View Attributes settings box opens.

    6. Turn on Text Nodes in View 2.

    7. Close the View Attributes settings box.

    314_dbif.fra Page 22 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    23/54

    Creating Database LinkagesWorking with a form dialog

    MicroStation/J Tutorial Workbook 13-23

    8. Turn on level 42 in all views.

    Level 42 contains more text associated with the parcels.

    Views 1 and 2, and the parcel form, set up for the exercise

    Currently, the form is displaying database information for parcelnumber 34. You will now locate this parcel in View 2.

    Locate parcel number 341. In the parcel form, click Locate.

    You are prompted to Select Display View.

    2. Enter a data point in View 2.

    The centroid dot for the parcel highlights (in both views).

    3. Accept with a second data point in View 2.

    View 2 zooms in on the required parcel. A red circle definesthe location of the first element linked to the database. In thiscase, it has centered on a blank text node.

    314_dbif.fra Page 23 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    24/54

    13

    13-24 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    4. Enter a 3rd data point in View 2.

    The red circle and View 2 now centers on the centroid ofparcel 34.

    5. Enter a 4th data point in View 2.

    The message Locate Complete appears in the status bar.This indicates that no other elements are linked to thedatabase for this parcel.

    6. You can use the Zoom Outview control to display more ofthe surrounding area.

    In the above example, you reviewed the database attributes of aparcel and then located it. Any parcel that has linkages to the

    database can be located. Where an element has no linkages anInformation box displays the message No element linked to thecurrent Row. If you turn off text nodes, the parcel numbers will be easierto read. With text node display off, however, the locate feature mayappear to first center on a blank region of the design that is, on a blanktext node.

    Locate other parcels

    1. In the parcel form, click Query.

    The original query is submitted and the first record meeting thequerys criteria is displayed.

    2. Click Last, to advance to the last record.

    3. As before, use the Locate button to locate this parcel.

    314_dbif.fra Page 24 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    25/54

    Creating Database LinkagesCustomizing query forms

    MicroStation/J Tutorial Workbook 13-25

    4. Locate other parcels by using the Previous and Next buttons

    to scroll through the records.Note that not all records in the database are linked tographical elements in the design file.

    Customizing query forms

    Up to this point, you have used forms that display all the possiblefunctions. In most cases this is not necessary. For example, youcan set up the form for querying the database only, without thebuttons for the modifying functions.

    Prepare for the exercise

    1. Close the form.

    2. Open the Visual SQL Query Builder dialog box.

    3. From the dialog boxs Settings menu, choose Forms.

    The Standard Form Items dialog box opens.

    4. In the Query and Modify Items group box, turn off all itemsexcept Query Button and Clear Form Button.

    5. In the Graphic Items group box, turn off Attach Row Buttonand Detach Row Button.

    6. Leave all other items turned on.

    7. Click OK.

    Standard Form Items dialog box set up for the exercise

    To create the form you will open the query that you saved earlier.

    314_dbif.fra Page 25 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    26/54

    13

    13-26 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    Create a modified form

    1. From the Visual SQL Query Builder dialog boxs Queriesmenu, choose Open.

    The Open SQL Query From dialog box opens.

    2. In the Files list, select values.sql, the query that you saved ina previous exercise.

    3. Click OK.

    The dialog box updates with the SQL Select Statement nowdisplayed.

    4. Click Execute.

    The new parcel form opens.

    The new layout of the query form

    Using this new form you can scroll through the results of thequery, using the First, Last, Next and Previous button. You canalso Review and Locate graphical elements and their databaseattributes. In addition, you can Clear the form and Query thedatabase via the database columns that appear on the form. Forexample, you can find all parcels that have a cost per square footthat exceeds $2.50.

    Query the database via the new form

    1. In the parcel form, click Clear.

    2. In the Parc_value/parc_area field, key in >2.5.

    3. Click Query.

    The form updates with the first record matching the querycriteria.

    314_dbif.fra Page 26 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    27/54

    Creating Database LinkagesDesigning query forms graphically

    MicroStation/J Tutorial Workbook 13-27

    Designing query forms graphically

    You can further edit and customize query form dialogsgraphically. For example, you can resize and relocate buttons anddata fields. In the following exercise you will see how to do this.

    Prepare for the exercise

    1. Close the parcel form.

    2. From the Visual SQL Query Builder dialog boxs Forms menu,choose Edit.

    The Edit Form dialog box opens.

    3. In the Files list, select the form that you saved earlier values.rsc.

    4. Click OK.

    The selected form dialog opens, plus the editing dialog boxand the Tools tool box.

    5. Minimize the Visual SQL Query Builder dialog box.

    The Tools tool box and the editing dialog box.

    First, change the size of the Locate button.

    Resize the Locate button graphically

    1. In the form dialog, click Locate.

    Handles appear at the corners of the button. At the sametime, the relative item is highlighted in the editing dialog box.

    2. Drag and drop a vertical edge to change the length.

    You can also drag and drop a corner (handle) to alter thelength and width together.

    314_dbif.fra Page 27 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    28/54

    13

    13-28 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    3. Click anywhere inside the form dialog to deselect the Locate

    button.The handles on the Locate button disappear and the new size issaved.

    In theeditingdialogbox,thelowerlist box displaysthecurrentlyselecteditemhighlighted. Theoriginaldimensionsaredisplayedhere.Belowthelist box are the input fields.

    Resize the Review button via the editing dialog box

    1. In the edit dialog box, scroll through the lower list box andselect Review in the Label column.

    Handles appear on the Review button in the form dialog.

    2. In the Wdth field at the bottom of the edit dialog box,highlight the existing value and key in 10.

    3. Press to complete the resize.

    The Review button updates with the new width. Notice thatthe Wdth dimension has not changed in the lower list box. Currentlythe new dimension, in the edit field, is in memory only. Until youSave the modification, it is in memory only.

    Save the modification

    1. In the editing dialog box, click Save.

    An Alert box asks you if you want to overwrite the originaldialog.

    2. Click OK in the Alert box.

    The edit dialog box updates. The new dimensions for thealtered button is now permanent.

    Next, you will delete the buttons that are not required on theform dialog. These consist of the buttons that allow editing andmodifying of the database, plus the query input field.

    Delete the database editing buttons and query field

    1. In the form dialog, click Insert.

    Handles appear at the corners of the button.

    2. While holding down the key, click the Update, Delete,

    Attach, and Detach buttons.

    Handles appear at the corners of each selected button.

    3. Still holding down the key, click in the Query field.

    314_dbif.fra Page 28 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    29/54

    Creating Database LinkagesDesigning query forms graphically

    MicroStation/J Tutorial Workbook 13-29

    4. From the editing dialog boxs Edit menu, choose Delete.

    An Alert box appears warning that the selected items will bedeleted from the original dialog.

    5. Click OK in the Alert box.

    The selected items are removed.

    The form dialog, with the resized Locate and Review buttons, after deleting the selected items.

    Next, you will resize all buttons to match the size of the Reviewbutton, which you reduced in size previously.

    Resize all buttons to match the Review button

    1. In the form dialog, click the Review button.

    Handles appear at the corners of the button.The first button selected is the button that is used as atemplate for the others.

    2. While holding down the key, click each of theremaining buttons (Query, First, Prev, Next, Last, Clear).

    3. From the editing dialog boxs Alignment menu, choose MakeSame Size.

    All selected buttons are resized to match the Locate button.

    314_dbif.fra Page 29 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    30/54

    13

    13-30 MicroStation/J Tutorial Workbook

    Creating Database LinkagesWorking with Database Linkages

    4. Enter a data point in a clear area of the form dialog to

    deselect the buttons.

    The buttons after resizing to match the Locate button.

    To reposition the buttons, you can click and drag them to theirnew locations.

    Move the Query and Clear buttons

    1. Click and drag the Query button to a point just below theword Functions.

    2. Click and drag the Clear button to a position to the right ofthe Query button. Do not worry if they are not exactlyaligned horizontally.

    Options in the Alignment menu let you finish off the positioningof items.

    Align the Clear button horizontally with the Query

    button, and then center them on the dialog1. Click the Query button.

    Handles appear on the Query button.

    2. Hold down the button and click the Clear button.

    Handles now are visible on both buttons.

    3. From the editing dialog boxs Alignment menu, choose Centeron Horizontal.

    The two buttons align horizontally. The first selected buttonremains as is, and the other selected button aligns with it.

    4. From the Alignment menu, choose Spread Horizontally.

    The two buttons are placed symmetrically (horizontally) in

    the form dialog.

    5. Enter a data point in a clear section of the form dialog todeselect the buttons.

    314_dbif.fra Page 30 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    31/54

    Creating Database LinkagesDesigning query forms graphically

    MicroStation/J Tutorial Workbook 13-31

    You can also use the Item Position Adjustment dialog box to

    move items, or to assist with dragging items on screen.

    Use the Item Position Adjustment dialog box to assistmoving items

    1. From the edit dialog boxs Options menu, choose PositionAdjustment.

    The Item Position Adjustment dialog box opens.

    2. In the form dialog click the Prev button.

    3. In the Item Position Adjustment dialog box, click the Upbutton.

    The Prev button moves upward by the distance defined in theY increment field. The X increment defines horizontal

    movement increments.

    4. In the Item Position Adjustment dialog box, turn offHorizontal, leaving Vertical turned on.

    5. Drag the Prev button to a point just below the Query button.Notice that you cannot move the button horizontally.Movement is restricted to Vertical.

    As you have just seen, the Item Position Adjustment dialog boxlets you control the movement of items. With the Prev button stillselected, you can now align the First, Next, and Last buttonshorizontally.

    Align positioning buttons horizontally1. With the Prev button already selected, hold down the

    key and click the First, Next, and Last buttons.

    2. From the Edit dialog boxs Alignment menu, choose Centeron Horizontal.

    The four buttons are aligned.

    3. From the Edit dialog boxs Alignment menu, choose SpreadHorizontally.

    The four buttons are placed symmetrically across the formdialog.

    Using similar methods, you can reposition the data fields. Borders

    for the group box also can be resized and moved. Experiment

    314_dbif.fra Page 31 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    32/54

    13

    13-32 MicroStation/J Tutorial Workbook

    Creating Database LinkagesDisplaying database attributes in the design

    with these tools to create your own customized form dialog.

    Remember to save your results.

    Sample of the form dialog after modification.

    This has been an introduction to the tools available for creatingcustom forms. For further modifications, a selection of tools in theTools tool box let you add items to a form. When you havefinished experimenting with the form editing tools, close theediting dialog box, which closes the Tools tool box also. If you have notsavedyourchangesbeforeclosingthedialogbox,aSavedialogboxopensto let you save the changes.

    Before continuing, set the forms settings back to the default

    1. Re-open the Visual SQL Query Builder window.

    2. From the Visual SQL Query Builder windows Settings menu,choose Forms.

    The Standard Form Items dialog box opens.3. Turn on all items.

    4. Click OK.

    Displaying database attributes in the design

    In no way is a database linkage more apparent than when one or more ofan elements database attributes are displayed near the element in thedesign.Displayableattributetextnodesareusedtodisplayattributes.Different types of displayable attribute text nodes can be defined todisplay different combinations of attributes in various formats. A

    displayable attribute tablepointed to from thedastable column ofMSCATALOG specifies the display format for each type of displayableattribute text node.

    314_dbif.fra Page 32 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    33/54

    Creating Database LinkagesDisplaying database attributes in the design

    MicroStation/J Tutorial Workbook 13-33

    Prepare for the exercise

    1. If necessary, open the Visual SQL Query Builder dialog box.

    2. Click the Select tab.

    3. Check that Dataset Mode and Execute Query on Open areturned on.

    4. Click Tables.

    The Select Table dialog box opens.

    5. In the list of tables, double-click mscatalog.

    The mscatalog table opens in the Visual SQL Query Builderdialog box.

    6. Click Close.

    You will now build an SQL statement to view the displayableattribute table for the parcel table.

    Submit SQL statement to review the displayable attributetable for the parcel table

    1. In the mscatalog table list, double-click *

    This selects all items in the table.

    2. Click the Where tab.

    3. In the Available Fields list, select tablename.

    4. In the Common Operators group box, click =.

    5. In the Value field, key in parcel.

    6. Click Apply.

    The Where clause is added to the SQL statement.

    314_dbif.fra Page 33 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    34/54

    13

    13-34 MicroStation/J Tutorial Workbook

    Creating Database LinkagesDisplaying database attributes in the design

    7. Click Execute

    The name of the displayable attribute table for parcel parcel_das is retrieved, among other data.

    You can now queryparcel_das to view the format of the firstdisplayable attribute type. You can do this by submitting an SQLstatement.

    Queryparcel_das

    1. In the Visual SQL Query Builder dialog box, Click ClearSQL.

    An Alert box asks if you want to clear all tables in addition tothe text of the SQL statement.

    2. In the Alert box, click Clear Text.

    The SQL Select Statement text box is cleared of text, apartfrom the SELECT and FROM SQL operators.

    3. In the SQL Select Statement box, following the word SELECT,key in *

    4. Following the word FROM, key in parcel_das.

    The select statement now reads:

    SELECT *

    FROM parcel_das5. Click Execute.

    The column values in the first row ofparcel_das areretrieved and displayed in the parcel_das form. The dastypevalue, 1, is the displayable attribute type. The sqldas value is

    314_dbif.fra Page 34 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    35/54

    Creating Database LinkagesDisplaying database attributes in the design

    MicroStation/J Tutorial Workbook 13-35

    a SQL statement that selects the attributes to display. Here,

    dastype 1 is an SQL statement that selects owner, andparc_value from the parcel table

    The optional formname value identifies a screen form fordisplaying the attributes. The screen form is parcel (asillustrated) for Xbase; for Oracle or INFORMIX, the screenform is owner (see Oracle PRE-FORM trigger in Chapter 4 inthe Administrators Guide).

    6. Two additional displayable attribute types are defined inparcel_das. Click the Next button after examining each type.

    Next you will place and prepare an empty text node as aplaceholder for displayable attributes.

    Prepare to place an empty text node

    1. Close the form dialog boxes.

    2. Minimize the Visual SQL Query Builder window.

    3. Turn off all views except View 1.

    4. If necessary, maximize View 1.

    5. Turn off levels 39 and 42 (to reduce screen clutter for the exercise).

    6. Use theWindow Areaview control to magnify the lower right parcel(parcel number 37).

    7. From the Settings menu, choose View Attributes.

    The View Attributes settings box opens.

    8. If necessary, turn on Text Nodes.

    314_dbif.fra Page 35 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    36/54

    13

    13-36 MicroStation/J Tutorial Workbook

    Creating Database LinkagesDisplaying database attributes in the design

    9. Click Apply.

    10. Close the View Attributes settings box.

    Place an empty text node

    1. In the Text tool box, select the Place Text Nodetool.

    2. Enter a data point below the parcel centroid, to mark thelocation of the text node.

    3. Reset to finish.

    After placing the empty text node (number 515)

    Designate the text node as a displayable attribute text node oftype 1

    1. If necessary, open the Database tool box.

    2. In the Database tool box, select the Attach DisplayableAttributestool.

    Notice the DA Type setting for the tool is already set to thedesired type 1. This setting can also be set in the Databasesettings box.

    3. Identify the centroid of the parcel that is near the empty textnode.

    4. Accept the parcel.

    5. Identify the text node.

    6. Accept the text node.

    With the text node designated as a displayable attribute text node,you can now load the attributes (type 1) into the text node.

    314_dbif.fra Page 36 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    37/54

    Creating Database LinkagesDefining a displayable attribute type

    MicroStation/J Tutorial Workbook 13-37

    Loadtheattributesspecifiedindisplayableattributetype1into

    the text node1. In the Database tool box, select the Load Displayable

    Attributestool.

    2. Identify the text node.

    3. Accept the text node.

    The text node is loaded and the attributes are displayed. Thatis, owner, and parc_value.

    The text node with the displayable attributes loaded.

    4. To clarify the display, you can turn off text nodes.

    Select Settings > View Attributes to open the View Attributessettings box.

    With text nodes turned off, the information is more easily read.

    Defining a displayable attribute type

    Most likely you will rarely require that all attributes bedisplayable. More often, you will want to display a subset ofattributes. For example, in the previous exercise, only the ownername and assessed value were extracted from the database.

    Suppose, for a plot, you need to show the owner name, parcelnumber, area, and assessed value. To do this you will add a rowto parcel_das to create a new displayable attribute type, type 4,that specifies these attributes. You will do this via the SQL

    314_dbif.fra Page 37 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    38/54

    13-38 MicroStation/J Tutorial Workbook

    Window, and then use the Visual SQL Query Builder to view the

    results.

    Create displayable attribute type 4

    1. In the Key-in window, key in SQL.

    The SQL Window opens.

    2. In the SQL Windows key in box (at the bottom) key in:

    INSERT INTO parcel_das VALUES (4,'parcel','SELECTowner,parcel_no,parc_area,parc_value FROM parcel')

    3. In the SQL Window, click Submit.

    In the status bar, the message SQL statement processed appears.

    To confirm that the table parcel_das contains the values that youjust inserted, you can use the same statement as before in theVisual SQL Query Builder dialog box. The required statementshould still be there, from an earlier procedure.

    Confirm that the new row has been inserted intoparcel_das

    1. Re-open the Visual SQL Query Builder dialog box (selectWindow > Visual SQL Query Builder).

    2. Check that the SQL Select Statement in the Visual SQL QueryBuilder dialog box still reads:

    SELECT * FROM parcel_das.

    3. Click Execute.

    The parcel_das form dialog opens. Notice that it now displays1 of 4, whereas previously it read 1 of 3.

    314_dbif.fra Page 38 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    39/54

    Creating Database LinkagesDefining a displayable attribute type

    MicroStation/J Tutorial Workbook 13-39

    4. Click Last to get to the new item.

    Notice that the information displayed is the same as thatwhich you placed with the INSERT statement.

    The parcel_das form dialog, displaying the newly inserted row.

    Having created a new displayable attribute type, you will now useit to display the required information for a number of parcels.

    Prepare for the exercise

    1. Close the open form dialog (parcel_das).

    2. Close the SQL Window, and the Visual SQL Query Builderdialog box.

    3. Use the view controls to display parcels 34 through 43 (located in the

    lower right section of the design).

    Parcels 34 through 43 in the lower right section of the design.

    314_dbif.fra Page 39 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    40/54

    13

    13-40 MicroStation/J Tutorial Workbook

    Creating Database LinkagesDisplaying database attributes in the design

    First you will place empty text nodes in several adjacent parcels.

    Place empty text nodes in parcels 34 to 36

    1. Use the View Attributes settings box to turn on Text Nodes.

    (Select Settings > View Attributes to open the View Attributessettings box.)

    2. In the Text tool box, select the Place Text Nodetool.

    3. In parcels numbered 34 to 36, place text nodes below thecentroid point of each parcel.

    4. Reset to finish.

    Next you will associate each text node with its respective parcel

    centroid.

    Attach display attributes to text nodes

    1. In the Database tool box, select the Attach DisplayableAttributestool.

    2. In the tool settings DA Type field, key in 4.

    3. Identify the centroid dot in parcel 34 (the leftmost parcel ofthe three).

    4. Accept.

    5. Identify the text node below the centroid dot.

    6. Accept.

    7. Reset to complete.

    8. Repeat steps 3 to 7 for the remaining two parcels.

    In each case, remember to reset after accepting the text node(step 7).

    To load the displayable attributes to the text nodes, you can use afence to complete the operation in one step.

    Load the displayable attributes using a fence

    1. Use the Place Fencetool to place a fence around thecentroids and empty text nodes for the three parcels.

    2. In the Database tool box, select the Load DisplayableAttributestool.

    3. In the tool settings, turn on Use Fence and, if necessary, set itto Inside.

    314_dbif.fra Page 40 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    41/54

    Creating Database LinkagesGenerating Report Tables

    MicroStation/J Tutorial Workbook 13-41

    4. Accept the fence contents.

    The attributes specified for displayable attribute type 4 aredisplayed in the appropriate parcels. These can be seen moreclearly if you turn off Text Nodes in the view.

    5. Again select the Place Fencetool to dismiss the fence.

    Parcels 34 to 36 after loading the displayable attributes (parcel 37 was used in a previous exercise)

    Generating Report Tables

    You can use the Generate Report Tabletool, with a fence, to generate areport table, which contains a row for each row of a table that is attachedto a fenced element. A report table contains selected data that can beformatted and printed with a database report writing program. Thefollowing exercises introduce you to:

    Reporting database attributes of fenced elements.

    Querying a report table.

    Specifying selection criteria with a fence filter.

    Todo thistutorialyoumusthavepreviouslyperformedtheproceduresinSettingUpfortheDatabaseInterfaceinChapter4intheAdministratorsGuidefor setting up the database for MicroStation/J, setting upMicroStation/J for the database, and connecting to the database fromwithin MicroStation/J. You must also have the design file cd9.dgn

    314_dbif.fra Page 41 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    42/54

    13

    13-42 MicroStation/J Tutorial Workbook

    Creating Database LinkagesGenerating Report Tables

    open in MicroStation/J with the sample gis database attached. Design

    file cd9.dgn is located in the Workspace/projects/tutorials/intro/dgn directory.

    Reporting database attributes of fenced elements

    Report tables must be named before they are generated. Report tablenames are stored in the reporttable column of the MSCATALOG table.

    Prepare for the exercise

    1. If necessary, maximize View 1 and use the view controls todisplay parcels 34 to 43 (located at the lower right of thedesign).

    2. From the Settings menus Database sub-menu, choose QueryBuilder.

    The Visual SQL Query Builder dialog box opens.

    3. Click Tables.

    The Select Table dialog box opens.

    4. In the Select Table dialog box, double-click on mscatalog.

    The mscatalog table opens in the Visual SQL Query Builderdialog box.

    5. Click Close.

    The Select Table dialog box closes.

    Use the Visual SQL Query Builder to confirm a reporttable name is specified for the parcel table

    1. If necessary, click the Select tab.

    2. In the mscatalog list, double-click tablename, reporttable,and fencefilter.

    3. Click Execute.

    The mscatalog form dialog opens, displaying the first row ofthe requested data.

    314_dbif.fra Page 42 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    43/54

    Creating Database LinkagesReporting database attributes of fenced elements

    MicroStation/J Tutorial Workbook 13-43

    4. Click the Next button until the row for the Tablename parcel

    is displayed.

    Mscatalog form dialog displaying the row for parcel table.

    If the row for the parcel table is different to that shown above, then editthe text in the Reporttable and Fencefilter fields to be parcel_reportand select * from parcel respectively. After editing the fields,click Update.

    When you have verified/edited the fields for the parcel table,you can close the mscatalog form dialog and generate a reporttable for the contents of a fence. The information generated in thereport will obey the selection criteria of the fence filter field in theparcel table.

    314_dbif.fra Page 43 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    44/54

    13

    13-44 MicroStation/J Tutorial Workbook

    Creating Database LinkagesGenerating Report Tables

    Generate a report table namedparcel_reportwith all rows of

    parcel that are attached to fenced parcels1. Use the Place Fencetool to place a fence around parcels 34 to

    43 inclusive. Make sure that the centroid dot at least, for eachparcel, is included inside the fence.

    Parcels 34 to 43 with the fence in place around them.

    2. In the Database tool box, select the Generate Report Tabletool.

    3. Accept the fence contents.

    The parcel_report table is created. MicroStation/J

    determines which elements contained in the fence havelinkages to the parcel table and copies the attributeinformation to the parcel_report table.

    You can review the information in the newly created report tablevia the Visual SQL Query Builder dialog box.

    Review the attribute information in the new report table

    1. In the SQL Query Builder dialog box, click ClearSQL.

    An Alert box opens, asking whether you want to clear just thetext, or the tables as well.

    2. In the Alert box, click Clear All.

    3. Click Tables.The Select Table dialog box opens. Notice that now there is atable for parcel_report now available.

    4. In the Select Table dialog box, double-click parcel_report.

    314_dbif.fra Page 44 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    45/54

    Creating Database LinkagesQuerying a report table

    MicroStation/J Tutorial Workbook 13-45

    5. Click Close.

    6. In the Visual SQL Query Builder dialog box, double-click *in the parcel_report table list.

    7. Click Execute.

    The parcel_report form dialog opens, with the first recorddisplayed.

    8. Click the Next Page button to see further information for thedisplayed row.

    9. Click the Next button to retrieve the attributes of successiveparcels in the fenced area.

    10.When you have finished, close the parcel_report formdialog.

    The parcel_report form dialog, displaying the first of 10 retrieved rows of database attributes.

    Querying a report table

    After you generate a report table that covers a portion of a design, youcan query the report table in the same manner as a permanent table tofind elements within the reported area whose attributes meet specifiedcriteria.

    314_dbif.fra Page 45 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    46/54

    13

    13-46 MicroStation/J Tutorial Workbook

    Creating Database LinkagesGenerating Report Tables

    For example, suppose you wanted to find parcels in the selected

    (fenced) area with greater than 17,000 square feet and anassessed value of less than $200,000.

    Query the parcel_report table to find the parcels in thereported area that meet the area and value criteria

    1. In the Visual SQL Query Builder dialog box, double-click *in the parcel_report list box to deselect all items.

    2. In the parcel_report list box, double-click the following:owner, parcel_no, parc_value, parc_area.

    Use the scroll controls to find those items not currently visiblein the list box.

    3. In the Visual SQL Query Builder dialog box, click the Where

    tab.

    4. In the Available fields list, click parc_area.

    5. In the Common Operators group box, click > and, in theValue field, key in 17000.

    6. Click And.

    7. In the Available Fields list, click parc_value.

    8. In the Common Operators group box, click

  • 8/3/2019 Msj Databasev7 1

    47/54

    Creating Database LinkagesQuerying a report table

    MicroStation/J Tutorial Workbook 13-47

    10. Click Execute

    The parcel_report form dialog opens, displaying the first of3 records found that match the search criteria.

    11. Click the Next button to retrieve the attributes of successiveparcels that meet the criteria.

    12.When you have finished, close the parcel_report formdialog.

    Prepare for the next exercise

    1. In the Visual SQL Query Builder dialog box, if necessary,click the Where tab.

    2. Click Clear twice, to delete the two lines in the Where clause.

    3. Click the Select tab.

    The SQL Select Statement should now read:

    SELECT parcel_no, owner, parc_value, parc_area FROMparcel_report.

    4. Click Execute.

    The parcel_report form dialog opens, displaying the 4selected columns of the first record. Note that it again reports

    314_dbif.fra Page 47 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    48/54

  • 8/3/2019 Msj Databasev7 1

    49/54

    Creating Database LinkagesSpecifying selection criteria with a fence filter

    MicroStation/J Tutorial Workbook 13-49

    2. In the Tables list box, select parcel.

    The Fence Filter group box displays the current fence filterassociated with the parcel table. That is, select * fromparcel.

    MSCATALOG dialog box displaying the Fence Filter associated with the parcel table.

    3. Edit the text in the Fence Filter field to read:

    select * from parcel where parc_area > 17000 andparc_value < 40000

    4. Click OK.

    The Select Data Source dialog box opens.

    5. Use the controls in the Select Data Source to select your FileData Source, such as gis.dsn.

    6. Click OK.

    With the fence filter defined, any fence database operations onthe parcel table will be restricted to those rows that meet the newfence filter criteria.

    Generate a report table using the fence filter

    1. If necessary, use the Place Fencetool to place a fence aroundparcels 34 to 43 inclusive.

    2. In the Database tool box, select the Generate Report Tabletool.

    314_dbif.fra Page 49 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    50/54

    13

    13-50 MicroStation/J Tutorial Workbook

    Creating Database LinkagesGenerating Report Tables

    3. Accept the fence contents.

    MicroStation/J determines which elements contained in thefence have linkages to the parcel table that meet the fencefilter criteria and copies the attribute information to theparcel_report table. The new information replaces theinformation previously in the report table.

    Review the attribute information in the report table

    1. In the Visual SQL Query Builder dialog box, click Execute.

    The parcel_report form dialog opens. Note that this time, thetotal number of records is 3.

    2. Click the Next button to retrieve the attributes of successiveparcels in the fenced area that meet the criteria.

    3. When you have finished viewing the records, close the form dialogand the Visual SQL Query Builder dialog box.

    Next you will graphically review the elements selected by a fence filter. Itis helpful to first set the element highlight color to a color that is easilyvisible.

    Set the element highlight color

    1. From the Settings menu, choose Design File.

    The Design File Settings box opens.

    2. In the Category list box, select Color.

    3. From the Element Highlight Color option menu, choose thecolor that you prefer for highlighting.

    Highlightthefencedparcelswhoseattributesmeetthesearchcriteria specified with the fence filter

    1. If necessary, use the Place Fencetool to place a fence aroundparcels 34 to 43 inclusive.

    2. In the Key-in Window, key in:

    UC=hilite

    The centroid and parcel number for each fenced parcel thatmeets the criteria are highlighted with the chosen color.

    In the above exercise, the UC= key-in activates the sample usercommand (macro), hilite.ucm. For more information about usercommands, see User Commands in Chapter 8 in theAdministrators Guide.

    314_dbif.fra Page 50 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    51/54

    Creating Database LinkagesUsing an MDL Database Application

    MicroStation/J Tutorial Workbook 13-51

    Using an MDL Database Application

    Thislessonservesasanintroductiontothepowerandversatility affordedby the combination of the database interface and MDL applications.

    Preview

    You will learn how to use the sample MDL application gis.masupplied with MicroStation/J. The application is intended to beused specifically with the cd9.dgn design file and the parceltable that you used with previous lessons in this guide plus thecd10.dgn design file.

    You will use gis.ma to do the following:

    Simulate the process of pressing colored pushpins into a map,according to property value.

    Locate a parcel in a map and display the parcel.

    The application has two key-ins, PUSHPIN and PARCELLOCATE. While gis.ma is loaded in MicroStation/J, thesekey-ins can be keyed in the Key-in Window, just like any key-in.

    The MDL source code for gis.ma is installed in MicroStation/Js mdl/examples/database directory if you chose the MDL ProgrammingExamples installation option.

    Pressing pushpins

    The PUSHPIN key-in in gis.ma is used to simulate the processof pressing colored pushpins into a map, according to propertyvalue. Pushpins appear as solid, color-filled circles on parcels towhich rows of the parcel table are attached. A customizablecolor mapping table determines the color of each pushpin. Thearea of the map in which elements are examined is determined bythe location of the fence.

    Load gis.ma in MicroStation/J

    1. From the Utilities menu, choose MDL Applications.

    The MDL settings box opens.

    2. In the Available Applications list box, select GIS.

    314_dbif.fra Page 51 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    52/54

  • 8/3/2019 Msj Databasev7 1

    53/54

    Creating Database LinkagesLocating parcels

    MicroStation/J Tutorial Workbook 13-53

    You will use the PARCEL LOCATE key-in to locate parcels by their

    clt_no (client number) values. If the specified parcel is not in the activedesign file (cd9.dgn), the design file that contains the map specified bythe parcels mapid will be searched (this should be cd10.dgn).

    Locate parcels by their client number values

    1. Becausegis.mausesMicroStation/JsWindowAreaviewcontroltodisplay the parcel in View 1, open View 1 if it is not already open.Also, open the SQL Window.

    2. Use the ACTIVE REVIEW (RA=) key-in to specify the followingattributes:ownername,parcelnumber,assessedvalue,area,andmapID. In the Key-in Window, key in:

    RA=SELECT owner, parcel_no, clt_no,parc_value,parc_area, mapid FROM parcel

    3. In the Key-in Window, key in:PARCEL LOCATE

    The Parcel Location settings box opens.

    4. In the Parcel Number field, key in a clt_no value.

    The table below shows some valid clt_no values in parcel.Note that there are 5 spaces preceding the last two charactersof the clt_no value:

    Design File clt_no value

    cd9.dgn 120-JA 32

    cd9.dgn 120-JA 15

    cd10.dgn 120-JD 11

    cd10.dgn 120-OC 10

    314_dbif.fra Page 53 Thursday, May 20, 1999 9:05 AM

  • 8/3/2019 Msj Databasev7 1

    54/54

    13 Creating Database LinkagesUsing an MDL Database Application

    5. Click the Locate Parcel button.

    The parcel is displayed in View 1. The SQL Window shows theparcels owner, number, value, and area. Theparcel_novalue is thesame as the last two characters of the specified clt_no value.

    6. Repeat steps 4-5 with other clt_no values.

    314_dbif.fra Page 54 Thursday, May 20, 1999 9:05 AM