xFiles: Importing a .dctx file

Hi all
I want to load a .dctx file and store its contents in memory, and then write it to a database, so that I have my own data dictionary that I can manipulate and examine. I am working through the xFiles documentation and it seems possible. Has anyone else done this? Can you share your group/queue declaration structures to get me going?

Thanks in advance

not xFiles, but there is complete example how to load/save/parse/search/replace dctx files. This is EasyXml demo.

1 Like

Hi Mike

Thanks for your advice about EasyXML. I was curious to know if you wrote it, so I went to your website and found PostgreSQL-for-Clarion mentioned there.

I’m going to try it out. I’m really struggling with Clarion and PostgreSQL. I designed my data structure using TopSpeed file definitions in the dictionary. Now I want to create these same structures in PostgreSQL and all the wheels keep falling off. For example, this table won’t import into a dictionary.

CREATE TABLE public."Comments"
(
  "Guid" character(16) NOT NULL,
  "TimeStamp" real,
  "ServerTimeStamp" real,
  "DeletedTimeStamp" real,
  "UserGuid" character(16),
  "ScheduleGuid" character(16),
  "Comment" text,
  CONSTRAINT "Comments_pkey" PRIMARY KEY ("Guid")
)
WITH (
  OIDS=FALSE
);
ALTER TABLE public."Comments"
  OWNER TO postgres;

It’s one of the tables from the CIDC2019 mobile app that I wanted to create in PostgreSQL.

Any idea why it is broken?

Just tried to import your Comments table into the dictionary (C11) - no errors, but table definition has zero columns and zero keys. Other tables have been imported correctly. with columns and keys.

1 Like

I’m getting the same. Not sure where the columns and keys went. Will investigate further. Weird.

Hello Donn,

perhaps this could help: I’ve also encountered issues importing a table into the dictionary. We use Auto Export/Import feature to create dcv files. Unless this is disabled, the import won’t work!
So we need to disable Auto Export/Import, then import the table(s), save the dictionary, and then re-enable Auto Export/Import.

00

Best regards
Christoph

1 Like

Thanks. My default is already set as “Monitor Selected Dcts”. I think I may have used a reserved word, or maybe the ODBC driver just doesn’t like mixed case.

Pardon my ignorance, but what is a DCV file?

A dcv file is the dictionary exported to text.

For you definition I’d remove the “” from the definition. They make it case sensitive in Postgres which means you need a NAME attribute on the clarion side.

FWIW I often create the definition in Clarion, then attempt to browse the table in the dct. It comes up and says it doesn’t exist and would I like to create. I say yes. Then I go into pgadmin and fix that table up. (Clarion doesn’t get always it right)

1 Like

Note that a REAL in PostgreSQL is a SREAL in Clarion, not a REAL. If you want a REAL on the Clarion side (which in this case you do) you need a BIGINT on the PostgreSQL side. See https://www.capesoft.com/docs/NetTalk11/NetTalkApps.Htm#PostgreSQL

1 Like

Timestamp is a reserved word in postgres, though I’m not sure whether it would object to the case-sensitive version.

Are you trying to drive yourself crazy using case-sensitive column names like that? If you ever had to write your own query, then:

select timestamp
from comments

would tell you that the table comments does not exist. So you change that and get

select timestamp
from “Comments”

and it tells you timestamp does not exist.

IMO, the right way to set up tables for Clarion is to set them up on the server and then import the tables into the Clarion dictionary, not the other way round.

1 Like

One thing I noticed in your dictionary was the GUID field. I find that a STRING(36) or CSTRING(37) works best for GUID or UUID fields in PostgreSQL.

PostgreSQL will return a formated UUID string. If you want to send a UUID to PostgreSQL you need to format it the same way. In the database a UUID uses 16 bytes.

Paul

1 Like