This great little tool from @Mark_Sarson was released into the wild yesterday. I thought it might be fun to do a step by step and show how it can be used!
If anyone would like to test out a simple tool I have written to “start” helping with dct source control then give me a private PM.
My tool will allow you to select a dct and will create a respective json file, so xyz.dct will create xyz.json
json is much nicer to look through where wanting to know what changes you have made in your dct between versions.
Written in .Net and requires .net 4.5
Let’s take a look at it from the beginning!
Step 0 - Why?
I can be handy to know what has changed between one version of your DCT and another, particularly if you are using version control.
If you are doing any kind of continuous integration, automate it and you will have a very nice view into your DCT over time too!
Also, because cool right?!
Step 1 - Git Clone the Repo
Sure, you can just go grab the EXE but… boo, that is boring. Show us the code!
So we are going to go to the GitHub repo and “clone” it to your dev machine.
If you have the GitHub windows desktop client installed this is super easy, just click on the button:
Basically that is it. The Github client will ask you where to put it and proceed to grab all the latest files.
Once you have that you can either fire up Visual Studio and build the project or go directly to the included
bin\Debug\DCTVersioniser.exe and dependant DLL file.
Step 2 - Launch the DCTVersioniser
Find the EXE and run it:
The first time you run it you need to tell it where the Clarion Bin folder is:
This is stored in a reg key so you don’t have to do this again.
Step 3 - Select a DCT to export as JSON
Ok, so now for the fun part. The DCTVersioniser will take your DCT, run it through ClarionCL.exe to create a DCTX (xml) file and then push that through Newtonsoft.Json.JsonConvert.SerializeXmlNode to turn it into JSON. Neat!!
Select a DCT
Wait for a few seconds
Marvel at people.json !
The output will appear in the same directory as your DCT with the extention
json instead of
dct and look a little something like this:
Again though, Why?
Ok, so for example I added a new field to a table in the people.dct and created before after diffs of both the DCTS (xml) files and the json output of DCTVersioniser
This is what the diffs look like using WinMerge.
Now, imagine that the only change was from a STRING(20) to STRING(30).
With the DCTX version you have that embedded on line in amongst other things. With JSON that is much more readable IMO and way more helpful.
Thanks @Mark_Sarson !!