# How to handle changes in the dictionary

**URL:** <https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544>\
**Category:** questions\
**Tags:** mssql, dictionary\
**Created:** [September 13, 2020, 5:14pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544 "2020-09-13T17:14:18Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Werner](https://clarionhub.com/user_avatar/clarionhub.com/werner/32/1638_2.png) [@Werner](https://clarionhub.com/u/Werner)\
**Post date:** [September 13, 2020, 5:14pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/1 "2020-09-13T17:14:18Z")

</div>

I use Clarion 11 to create a front end to a sqldatabase in ms sql express. I usually create the database first with MS Sql Server Management Studio. The tables I then import into the application's dictionary.

This works fine and there is no big problem with that. But the problem for me is that I always need to make changes to the database afterwards. I need to add fields, change field types, create relationships etc.  
I try to update the dictionary manually afterwards to reflect the changes in the tables and this works most of the time.

But the best approach is import the updates tables and give them a new name in the dictionary. Afterwards I need to update all the browses, forms, trees etc with the new tablechanges. This is a lot of work.

I would like to get some advise from the community on what is 'best practices' that works best for other developers when they need to update their database back end.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![rob\_bac](https://clarionhub.com/user_avatar/clarionhub.com/rob_bac/32/686_2.png) [@rob\_bac](https://clarionhub.com/u/rob_bac)\
**Post date:** [September 14, 2020, 11:10am UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/2 "2020-09-14T11:10:51Z")

</div>

Hi Werner,

The easiest way is you only make changes in the dictionary and then the MS-SQL tables are automatic updated with the changes you made.  
For that i use Capesoft’s FM3 it does all that what you want!

[https://www.capesoft.com/accessories/FM3sp.htm](https://www.capesoft.com/accessories/FM3sp.htm)

Rob

---

<div class="post-metadata">

**Author:** ![acdl66](https://clarionhub.com/user_avatar/clarionhub.com/acdl66/32/1423_2.png) [@acdl66](https://clarionhub.com/u/acdl66)\
**Post date:** [September 14, 2020, 6:09pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/3 "2020-09-14T18:09:44Z")

</div>

Hi Werner, we do this manually. Most of the time when we need a new field we need to fill it not with a single default value but with logic that depends on the other fields, files, etc.  
Usually we write a sqlscript to make the change of the table layout, and the assigning of values ​​in the new layout.

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [September 15, 2020, 7:43am UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/4 "2020-09-15T07:43:31Z")

</div>

> [@Werner](#):
>
> I use Clarion 11 to create a front end to a sqldatabase in ms sql express. I usually create the database first with MS Sql Server Management Studio. The tables I then import into the application’s dictionary.

So far, so good.

> [@Werner](#):
>
> This works fine and there is no big problem with that. But the problem for me is that I always need to make changes to the database afterwards. I need to add fields, change field types, create relationships etc.

This is completely normal.  
[Aside: Relationships are a bit different because they are used differently on the server and client side, and do not need to match]

> [@Werner](#):
>
> I try to update the dictionary manually afterwards to reflect the changes in the tables and this works most of the time.

Good. You can change the server side, and dictionary to match. For small changes, especially as you gain experience, this is a good approach.

> [@Werner](#):
>
> But the best approach is import the updates tables and give them a new name in the dictionary.

Nooo - don’t do this… In no world is this the “best approach”… because …

> [@Werner](#):
>
> Afterwards I need to update all the browses, forms, trees etc with the new tablechanges. This is a lot of work.

exactly. Items in the dictionary are linked into the app using a (hidden) id called a GUID. By importing the table again you “disconnect” the app from the guids - which is a “bad thing”.

> [@Werner](#):
>
> I would like to get some advise from the community on what is ‘best practices’ that works best for other developers when they need to update their database back end.

As in most things, best practice depends on your context. you don’t say if this is a one-database system (ie only one production database out there) or if this is part of a package you intend to sell, and so have lots of databases out there. Which approach you take will depend on your context.

If you are a single-database system then manually changing the database, and manually updating the Dictionary to match is do’able. If you have a small number of databases to physically update a small script which you run manually is also ok.

If you are creating a commercial product then things are a bit different, because the manual approach does not scale well, and is prone to errors. In this context using an automatic upgrading tool (like File Manager 3 mentioned earlier) is definitively a good thing to do.  
[Disclosure: I profit from the sale of FM3, so consider by opinion here to be biased]

cheers  
Bruce

---

<div class="post-metadata">

**Author:** ![carlitm](https://clarionhub.com/letter_avatar_proxy/v4/letter/c/6bbea6/32.png) [@carlitm](https://clarionhub.com/u/carlitm)\
**Post date:** [September 15, 2020, 8:42am UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/5 "2020-09-15T08:42:52Z")

</div>

FM3 from CapeSoft is a must have in every project. The time savings are huge and it takes care of all dictionary changes without having to worry about it at all.

Carl

---

<div class="post-metadata">

**Author:** ![Jane](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@Jane](https://clarionhub.com/u/Jane)\
**Post date:** [September 15, 2020, 3:17pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/6 "2020-09-15T15:17:41Z")

</div>

You might also take a look at SQL Script.It! from ohnosoft. It’s written by John Hickey (one of the ClarionLive organizers) and Mary Wade. They’ve done a couple of ClarionLive webinars walking through how it works.

Might be overkill for your needs, but they have a free demo you can try:  
[https://ohnosoft.com/index.php/sql-scriptit/](https://ohnosoft.com/index.php/sql-scriptit/)

Jane

---

<div class="post-metadata">

**Author:** ![Rick\_UpperPark](https://clarionhub.com/user_avatar/clarionhub.com/rick_upperpark/32/346_2.png) [@Rick\_UpperPark](https://clarionhub.com/u/Rick_UpperPark)\
**Post date:** [September 15, 2020, 3:29pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/7 "2020-09-15T15:29:03Z")

</div>

IMO, FM3 is great as long as you are only using tables and indexes in the SQL database. FM3 does a good job of maintaining your file structures. However, once you move on from simple tables and start using other aspects of SQL (Stored procedures, views, computed columns, etc), then you have to maintain those on your separately. Rather than have two different upgrade methodologies, I’d recommend using a single solution. SQL Script.It is great, SQL Source Control, or you can role your own. Just make sure you are very meticulous about tracking your changes to the database regardless of the method you use.

---

<div class="post-metadata">

**Author:** ![Werner](https://clarionhub.com/user_avatar/clarionhub.com/werner/32/1638_2.png) [@Werner](https://clarionhub.com/u/Werner)\
**Post date:** [September 15, 2020, 5:42pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/8 "2020-09-15T17:42:38Z")

</div>

Thanks for your replies and comments. I do not use Clarion professionally at the moment, so money available for purchase of extras is limited. I use Clarion 11.  
My applications are quite simple with one database and approx. 30 tables and views. I also use Microsoft Access as a front end to test sql queries for views etc, before I create them in SSMS.

With regard to adding fields to tables does people have a strategy on this? Like for instance do you add fields to the end of the current sql table or do you drop the current table and place new fields inside the table in a place of your liking?.

I am not new to sql, but I am rather new to Clarion and SQL. The ‘problem’ with the update of the dictionary after database changes is relatively minor compared to how professional the application looks with Clarion. I like to use the traditional approach with mdi windows, browses/trees and update forms. My application is currently on the local pc, but since everything is moving to the sky nowadays, the plan is to modify the application to work as a front end for the database in the sky.

---

<div class="post-metadata">

**Author:** ![DonnEdwards](https://clarionhub.com/user_avatar/clarionhub.com/donnedwards/32/1047_2.png) [@DonnEdwards](https://clarionhub.com/u/DonnEdwards)\
**Post date:** [June 2, 2021, 1:28pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/9 "2021-06-02T13:28:38Z")

</div>

> [@Rick\_UpperPark](#):
>
> SQL Script.It is great,

Script.It doesn’t appear to be sold any more. I am using FM3 but it only transferred the primary key from my TPS files to PostgreSQL. Do I really have to create all the indexes and relationships by hand?

Sorry to revive an old topic

---

<div class="post-metadata">

**Author:** ![CarlosGtrz](https://clarionhub.com/user_avatar/clarionhub.com/carlosgtrz/32/5870_2.png) [@CarlosGtrz](https://clarionhub.com/u/CarlosGtrz)\
**Post date:** [June 2, 2021, 2:02pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/10 "2021-06-02T14:02:53Z")

</div>

> [@DonnEdwards](#):
>
> I am using FM3 but it only transferred the primary key from my TPS files to PostgreSQL. Do I really have to create all the indexes and relationships by hand?

For indexes, you can use `DCTMasterKeys`. See: [Key Management (essential reading when converting from TPS to SQL)](https://www.capesoft.com/docs/fm3/fm3sql.htm#Keys).

Relationships are not supported yet: [Does FM3 support the creation and maintenance of File Relationships on a SQL backend?](https://www.capesoft.com/docs/fm3/fm3.htm#SQ7)

---

<div class="post-metadata">

**Author:** ![Alla](https://clarionhub.com/user_avatar/clarionhub.com/alla/32/1892_2.png) [@Alla](https://clarionhub.com/u/Alla)\
**Post date:** [June 2, 2021, 2:49pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/11 "2021-06-02T14:49:13Z")

</div>

10 years ago I had to migrate TPS-\> MSSQL and TPS-\> Postgres  
I exported the original DCT (tps)  
Then I wrote a program which analyzes this dct and operates on the changes  
Ex

TPS: MyDate Date  
by generating MydateS string (8)  
MydadeG group, OVER (MyDateS)  
Mydate Date  
Mydate\_Time Time  
End

Change ULONG → LONG (postgress case)  
and others …

Result: I import my new dct mssql from this text

Alla

---

<div class="post-metadata">

**Author:** ![DonnEdwards](https://clarionhub.com/user_avatar/clarionhub.com/donnedwards/32/1047_2.png) [@DonnEdwards](https://clarionhub.com/u/DonnEdwards)\
**Post date:** [June 2, 2021, 3:02pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/12 "2021-06-02T15:02:37Z")

</div>

> [@CarlosGtrz](#):
>
> For indexes, you can use `DCTMasterKeys`

THANK YOU! Problem solved. I guess RTFM is in order. 😊 I read this a while ago and forgot about it again. Thanks for the reminder.

---

<div class="post-metadata">

**Author:** ![Rick\_UpperPark](https://clarionhub.com/user_avatar/clarionhub.com/rick_upperpark/32/346_2.png) [@Rick\_UpperPark](https://clarionhub.com/u/Rick_UpperPark)\
**Post date:** [June 2, 2021, 9:41pm UTC](https://clarionhub.com/t/how-to-handle-changes-in-the-dictionary/3544/13 "2021-06-02T21:41:50Z")

</div>

To answer your other question, you do not need all of the indexes in your dictionary on the backend. If you do a fetch or get on an index in Clarion it just generates the SQL where clause with the equality values. The SQL engine will return that data regardless of whether or not there is an index. Same with sorting.  
Having an index on the backend can improve performance for returning data when the filter or order of the statement leads the engine to use that index, but too many indexes can impact insert/update operations.
