AI Prompt for creating a DB Reference HTML file via your DCT's .dctx file (or TXD)

I’m a longtime user of Carl’s CW Assistant. I’ve wished it had some basic SQL generation capability.

I just used Claude to create a Database Reference for my huge DCT that I can host on our website for internal use and for some power users. It can create basic SELECT statements for tagged fields in a selected table. Feel free to have the AI expand upon this, as I will be doing as well.

Just upload your app’s .dctx XML file and this prompt and update the prompt to include your APP NAME:

I've attached my Clarion application's data dictionary (.dctx, and optionally the
.txd version of the same dictionary). Please build me a single self-contained HTML
file that acts as a browsable, searchable reference for the whole database schema —
something my team can host as a static page and use day to day.

APP NAME: <<< INSERT YOUR APPLICATION/DATABASE NAME HERE, e.g. "Naviteer" >>>

Use the .dctx as the source of truth (it's clean XML); the .txd is the same data in
Clarion's native format and can be ignored if .dctx is present.

WHAT TO EXTRACT
- Every real <Table> element: name, description, prefix, driver (MSSQL / TOPSPEED /
  MEMORY / ASCII / BASIC / none), physical path (e.g. dbo.TableName for SQL Server
  tables), and usage.
- <Alias> elements are alternate names for a real table (used for self-joins etc.) —
  don't list them as separate tables in the browser, since that's just noise. Instead
  fold each one into a small "also referenced in code as: X, Y" note on the real table
  it belongs to.
- Fields, recursively — Clarion GROUP fields contain nested child <Field> elements
  (used to reinterpret the same memory region under different sub-fields). Extract
  these recursively and let a GROUP row expand to reveal its children in the UI.
- Watch for a pipe-delimited suffix in ExternalName, e.g. "SHP_ID | READONLY" — the
  part before "|" is the real physical column name; anything after it is a flag
  (READONLY usually means an identity/computed column). Split these apart and surface
  the flag as a small badge rather than treating it as part of the name.
- Keys/indexes per table, with their component fields resolved (Key > Component >
  FieldId is a GUID reference to a Field within the same table) in the correct
  composite order, noting which key is Primary and which are Unique.
- Relationships: top-level <Relation> elements reference PrimaryTable/ForeignTable/
  PrimaryKey/ForeignKey and PrimaryMapping/ForeignMapping field pairs, all by GUID.
  Resolve these into two lists per table — "links to" (this table's FK to a parent)
  and "linked from" (child tables pointing back at this one) — each showing the join
  field(s) and the delete rule. Some relations in real-world dictionaries are missing
  a resolvable ForeignKey/mapping (legacy/alias-based definitions) — still show these,
  just flagged as incomplete rather than dropped or crashing the build.

NAMING CONVENTION
Clarion refers to a field as PREFIX:FieldName (colon); the physical column name (for
SQL Server–backed tables) is typically PREFIX_FieldName (underscore) — that's the
cleaned ExternalName from above. Not every table has a SQL Server equivalent (TopSpeed
ISAM files, in-memory queues, flat files don't), so don't assume one exists.

UI REQUIREMENTS
- One HTML file, no build step, no server — embed the extracted schema as inline JSON.
- Page header (top left) should read "<APP NAME> | DATABASE REFERENCE" using the
  app name given above — e.g. "Naviteer | DATABASE REFERENCE" — and the browser tab
  title should follow the same convention.
- Two-pane layout: a searchable/filterable table list (by name, description, prefix,
  or field name) plus a detail pane.
- Detail pane shows Fields / Keys & Indexes / Relationships as an expandable
  drilldown — collapsible sections, with GROUP fields expanding to their children.
- Clicking a relationship jumps straight to the related table.
- Deep-linkable URLs (so a specific table can be bookmarked/shared) with a visible
  "Copy link" button — don't rely on people noticing the address bar changed.
- A small copy-to-clipboard icon next to every field name and every table's physical
  path, so someone can grab the SQL column/table name for an email or a query without
  retyping it. For tables/fields with no SQL Server equivalent, fall back to copying
  the qualified Clarion name instead.
- Query builder — ONLY if the dictionary contains at least one SQL Server–backed
  table: checkboxes next to fields that have a real SQL column, and a live-updating
  SELECT statement (with Select All / Clear / Copy SQL) pinned to the bottom of the
  screen as fields are checked. Skip this feature entirely (don't just disable it) if
  the dictionary has no SQL Server tables at all — there's nothing to query.
- Mobile-responsive and reasonably print-friendly. Should look like a proper internal
  engineering tool — not a generic template.

Before handing it back, actually verify it works: confirm the embedded JSON parses,
there's no leftover template placeholder text, and that search, table selection,
relationship navigation, and the copy buttons all function.

Enjoy!

Greg Berthume
www.datafortress.app

Can you share a screen shot of what this produces to help get a visual?

I created this using Claude which gives me a diagram relationship of all my files and i can zoom on relationships and it give file details. It is a 1 page interactive HTML page.


Just run the prompt along with your .dctx file. Takes minutes to product the result.

Wow! Very impressive!

Thanks. It was quite easy to get Claude to build with just a few sentences. I then had IT create the prompt so I could share it with others.

Hi,

I like Draw.io for diagrams, but lately I saw AI tools creating ER diagrams using the Marmaid format

There is live editor

Mermaid offers several key advantages: diagrams are text-based and live alongside your code, making them easy to version control and integrate into your development workflow. You can generate diagrams from docs and transcripts with AI, collaborate in real time, share with a single link (no login needed), and work directly inside the tools your team already uses.

Mermaid.js is the free, open-source diagramming library that powers text-to-diagram rendering. Mermaid is built on top of it, adding AI-powered generation, file uploads, a visual editor, real-time collaboration, team workspaces, plugins, and enterprise support. It was created by the team behind Mermaid.js to bring professional tooling to the Mermaid ecosystem.

Draw.io is great for one-off diagrams, but it creates a manual, file-based workflow that slows teams down. Every change requires a new export, every review requires a new upload, and every update requires a new layout.
Mermaid keeps diagrams in your codebase, so they stay version controlled, auto-layout, and instantly shareable. That means faster documentation, fewer file conflicts, and a developer-friendly workflow that keeps your team moving.

Hi,

Just as an aside, if anyone wants to use Mermaid diagrams from within the Clarion IDE, my Clarion Markdown Editor addin supports Mermaid diagrams in the live Markdown preview.

You can download the ZIP from the Releases section and install it directly.

Alternatively, if you use my Clarion Addin Finder, you can install and update the Markdown Editor from there:

And if you’re using Clarion Assistant, the Addin Finder is already included in that distribution, so you can install the Markdown Editor through that.

One of the nice things about Mermaid in this context is that the diagram remains part of the Markdown source, so it can live alongside the rest of your project documentation and be kept under source control.

For example, you can have the Mermaid source on one side of the Clarion IDE and see the rendered ER diagram immediately in the live preview.

I just ran it and did not get the samething you did
I did not get any banner or the 2nd page like you did with summary

Hi Flavio,

Mermaid diagrams are fantastic, and AI definitely makes them much easier to create.

Our new PageSnip software supports Mermaid diagrams both as standalone code pages and as diagrams embedded directly inside a normal Markdown document.

PageSnip also includes AI Helpers that make it easy for almost anyone to create Mermaid diagrams. You can select the type of diagram you want, or simply let the AI choose the appropriate type for you.

Then you just describe, in a few words, what you want the diagram to show.

The AI Helper builds a curated prompt and places it on your clipboard, ready to paste into your AI chat window.

The AI writes the Mermaid code. You click its Copy button, then tell PageSnip the result is ready.

From there, PageSnip can automatically create a new Mermaid page for you, or you can paste the generated diagram directly into an existing Markdown page alongside your other text and content.

PageSnip can also print the page or create a PDF with the Mermaid diagram fully rendered in place.

What A.I. ? I created mine via Claude Sonnet 5. I had it create the prompt but did not test it. Just tell the A.I. what you want and it will build it.

Claude - I gave it your prompt and that is what it produced. - I am sure ‘your’ Claude did it based on other things it has done for you - i created a skill from your prompt and had it build a small python script to produce this which is closer (and runs very quick and always produces the same format), but i don’t have any more time today to spend on this - but yes, it is interesting what Claude can do and i use it for all sorts of things. Thank you for sharing - I always like seeing what other’s are doing.

Hi,

I used your prompt to ask Gemini to create a mermaid ERD generator on a sigle-file HTML, based on an imported DCTx. It draw the diagram based on the selected tables.
I also asked to create a mermaid ERD generator a sigle-file HTML, based on a complex SQL SELECT.
Both with zoom features, mermaid code export and SVG export.

Very useful for documentation!
Thank you!

If anyone is interested, I can share the 2 HTML files.