Making Diagrams

 


SQLThing includes a diagram generator that allows you to develop quick ER type diagrams for documenting your database. The diagram generator must be used in conjunction with the Database Explorer and is therefore only available when the explorer is open.

The diagram editor understands objects on the AS/400 system and can make intelligent inferences about how objects are related.  These inferences are controlled via the Diagram Options tab of the Options panel. One thing that SQLThing can do is automatically guess relationships between objects, (even if there is no foreign key defined), based on the data type, column name and logical files built over the objects. If related fields are named the same in all files, you need do nothing to have this option work. However, if you use a naming convention where the first n characters of a field name indicate the table and the last n characters indicate the field name, you will need to set the skip-chars setting on the diagram options panel.

 To make a diagram, perform the following steps.

1)      Open the Database Explorer and navigate to the library you desire.

2)      Select the Explorer menu and then select Blank Diagram.

3)      Reposition the windows to suit drag and drop operations, similar to the figure below.

4)      Hold the CTRL key and then click and drag the desired table to the diagram window and drop it. SQLThing will render a representation of the table in the diagram window.

5)      Click to select another table, then use CTRL+Right Mouse to drag and drop it into the diagram. If SQLThing can infer a relationship between the tables, it will draw a connector indicating the relationship

Note that SQLThing will draw a solid line if the relationship is a foreign key and a dashed line if the relationship is inferred. SQLThing bases it’s inferences on the existence of logical files that could be used to join the two tables. In the example above, SQLThing has found that Branches could be linked to Budgets because the fields COMPANY and BRANCH are of similar data type and a logical file exists on BRANCHES by COMPANY and BRANCH. Therefore, SQLThing draws a line from BUDGETS to the linkable table BRANCHES. You may delete an inferred reference by clicking the line and then pressing the Delete toolbar icon, (the red X).

You can print diagrams using the printer icon available in the toolbar. At this time, SQLThing does not allow the saving of diagrams, but this is planned for an upcoming release.