SuperFile to DCT

by StevenP

A few years ago, I investigated Topspeed “SuperFiles.” I wrote about their internal design, how to make them in a dictionary, how to use NAME() with them and how to create a new SuperFile out of existing single table files.

One thing I forgot to investigate; one thing I never thought I'd need to know. Now I do. How do I make a dictionary from an existing TPS SuperFile (or make the appropriate dictionary entries in an existing dictionary)? I am not talking about a situation in which I've lost the dictionary and need to re-create it – shame on me if I don't have a backup nearby! I am talking about a situation in which I inherit a SuperFile but there is not and never has been a dictionary (let's say my predecessor was a hand coder, and leave it at that).

Of course, I can locate the file spec in the source files, make a dictionary and manually type in everything I need.

Similarly, suppose I don't have any .APPs or .CLWs, I can get the file layout information from TopScan (File | File Layout... and get the information from the pop up screen or, even, print it out).

Right. But I don't think so. If all else fails, perhaps … but only if all else fails.

Clarion, ever since there has been a separate dictionary (i.e., Clarion Database Developer, for DOS), has offered an option to import an existing file into a dictionary. In CDD, importing an existing file into a DCT used to be very easy: File | Import, navigate to the file, select it, bada bing bada boom, all done. In Windows, it is not so straightforward. Clarion now invokes “The Synchronizer.” And I have never mastered the Synchronizer (in other words, it gives me a lot of trouble – I blame it on SoftVelocity not making the prompts self-documenting and actually expecting me to understand something).

Additionally, there is the question “Will the Synchronizer handle a SuperFile?” Let's find out.

Step 1

The first step is to locate the SuperFile. For this exercise, I selected a four table SuperFile, the SuperFile that drives my WebBuilder FAQ app:

Figure 1: shpFAQ.TPS

Step 2

Next, open or create, as necessary, the target dictionary. Now I'm ready to see if I can import a SuperFile.

Step 3

Click the down arrow on the “Add Table” button in the Dictionary Editor:

Figure 2: Beginning the file import process

This calls the Synchronizer window.

Step 4

This is where I've always run into trouble. I've never quite grasped what “Select Server” referred to. Pressing the down arrow produces a drop box:

Figure 4: “Select Server” dropped

“Clarion Dictionary” is the default selection but clearly not helpful in the current exercise. Scrolling down the list reveals something much more useful:

Figure 5: TopSpeed file as “Server”

The remaining prompts are not relevant for the import of a file, so I press “Next.” So, it appears that “Select Server” is “source.” If so, the next window:

Figure 6: Select source

must be for selecting the files to import. The drop list is useless (empty, as I recall) so I pressed the ellipsis. This produced the standard Windows file dialog. So, I selected the SuperFile:

Figure 7: Source TPS file selected

Step 5

Et violá, a list of the tables inside the SuperFile!

Figure 8: Select file(s)/tables to import

Press the “select all” (“>>”) button and

Figure 9: Files/tables selected for import

Step 6

Time to celebrate, all of the tables show up in the dictionary:

Figure 10: Dictionary after import

Step 7

Every time I ever imported a file into a CDD dictionary, the FullPath Name prompt (NAME() attribute) contained the fully qualified DOS specification of the source file:

Figure 11: Table properties

This is almost never correct and needs to be edited. I might want a variable in the NAME() attribute, I might want a standard string (“shpFAQs\!DEVELOPERS” was in  the dictionary which originally created the SuperFile for this oversize). But I almost never want the fully drive and path in the NAME().

Conclusion

SuperFiles really are just ordinary TPS files. Or, as I previously demonstrated, all TPS files are actually SuperFiles and everything I can do with a single-table-TPS file, I can do with a multi-table-TPS file.