Export Dictionary Diagram

I’ve been tasked with creating some documentation on an existing app, including data diagram(s)

The relations and triggers are defined in Clarion not the back end SQL, so I can’t use SQL to do the diagram.

I’ve tried the Clarion diagram (C11) and it’s ok to a point, but I wanted to export the details so that I can tidy up add more data, is this possible?

I was also looking at the Reports View and exporting that data but I don’t seem to be able to even copy
& paste the rows.

Has anyone managed to export any of this data or create professional looking documents?

I wish I could provide more specific information… What I recall is I found a Web based Diagram Creator (like Viso) that took as input a fairly simple text file, like maybe Customers -> Invoices. So search the Web for Diagram Creator or Database Diagram, etc.

I think I used the TXA [RELATIONS] section then manually edited it to match the required input. If that an work it could probably be written in the right format by a Utility Template the reads the DCT.

Example of TXD Relations from School example below. The new DCTX format is in XML which may work better if you are used to working with XML.

[RELATIONS]
                       RELATION,MANY:ONE,UPDATE(CASCADE),DELETE(RESTRICT)
Teachers                 FILE(Tea:KeyDepartment)
Majors                   RELATED_FILE(MAJ:KeyNumber)
                         FILE_TO_RELATED_KEY
                           FIELD(Tea:Department,MAJ:Number)
                         END
                         RELATED_FILE_TO_KEY
                           FIELD(MAJ:Number,Tea:Department)
                         END
                       END

                       RELATION,ONE:MANY,UPDATE(CASCADE),DELETE(RESTRICT)
Courses                  FILE(COU:KeyNumber)
Classes                  RELATED_FILE(CLA:KeyCourseNumber)
                         FILE_TO_RELATED_KEY
                           FIELD(COU:Number,CLA:CourseNumber)
                           FIELD(NOLINK,CLA:ClassNumber)
                         END
                         RELATED_FILE_TO_KEY
                           FIELD(CLA:CourseNumber,COU:Number)
                         END
                       END

                       RELATION,ONE:MANY,UPDATE(CASCADE),DELETE(RESTRICT)
Teachers                 FILE(Tea:KeyTeacherNumber)
Classes                  RELATED_FILE(CLA:KeyTeacherNumber)
                         FILE_TO_RELATED_KEY
                           FIELD(Tea:Number,CLA:TeacherNumber)
                         END
                         RELATED_FILE_TO_KEY
                           FIELD(CLA:TeacherNumber,Tea:Number)
                         END
                       END

                       RELATION,MANY:ONE,UPDATE(CASCADE),DELETE(RESTRICT)
Students                 FILE(STU:MajorKey)
Majors                   RELATED_FILE(MAJ:KeyNumber)
                         FILE_TO_RELATED_KEY
                           FIELD(STU:Major,MAJ:Number)
                         END
                         RELATED_FILE_TO_KEY
                           FIELD(MAJ:Number,STU:Major)
                           FIELD(NOLINK,STU:LastName)
                           FIELD(NOLINK,STU:FirstName)
                         END
                       END

Here is a template utility I use to export the dictionary relationships as a CSV file. You can manipulate it from there to whatever you need.
I’ve used Dezign (Data Modeling Tool | DeZign for Databases) to create data models for sharing with other organizations.

#!
#! ***************************************************************************
#! *  Generate relationships 
#! ***************************************************************************
#!
#UTILITY(DictionaryRelationships,'Dictionary Relationships')
#DISPLAY('')
#DISPLAY ('')
#PROMPT ('Save as CSV', CHECK), %SaveAsCSV,DEFAULT('1'),AT(10)
#PROMPT ('Save to File:', SAVEDIALOG ('Pick File', 'Help Text File|*.txt|CSV File|*.csv')), %SaveToFile
#PREPARE
    #SET (%SaveToFile, %Application & '.csv')
#ENDPREPARE
#DECLARE(%OutputLine)
#DECLARE(%HoldFile)
#DECLARE(%HoldRelation)
#CREATE (%SaveToFile)
  #IF(%SaveAsCSV=1)
    #SET(%OutputLine,%Application & ',Parent Table,Child Table,Relation Type,Primary Key,Foreign Key,Primary Linking Column,Secondary Linking Column,OnDelete,OnUpdate')  
%OutputLine
    #FOR(%File)
      #FOR(%Relation),Where(%FileRelationType='1:MANY' And %RelationAlias='')
    #SET(%OutputLine,',' & %File & ',' & %Relation & ',One:Many,' & %FileKey & ',' & %RelationKey & ',')
    #SET(%HoldFile,%File)
    #SET(%HoldRelation,%Relation)
    #FOR(%FileKeyField)
      #FIX(%Field,%FileKeyField)
      #SET(%OutputLine,%OutputLine & %FieldID)
      #FIND(%Field,%FileKeyFieldLink)
      #SET(%OutputLine,%OutputLine & ',' & %FieldID)
      #BREAK
    #ENDFOR
#!    #FIX*%File,%HoldFile)
#!    #FIX*%Relation,%HoldRelation)
    #SET(%OutputLine,%OutputLine & ',' & %RelationConstraintDelete & ',' & %RelationConstraintUpdate)
%OutputLine    
      #ENDFOR
    #ENDFOR
  #ELSE
    #FOR(%File)
    --- %File, Relations: 1:MANY --------------------
      #FOR(%Relation),Where(%FileRelationType='1:MANY' And %RelationAlias='')
              %Relation - %FileKey, Relation Action: %RelationConstraintDelete
      #ENDFOR
    #ENDFOR
  #ENDIF
#CLOSE
3 Likes