Creating a record class without using the UML

If you use our File Manager classes then you know we use the UML model to generate our record classes from the Analysis. This works great when you already have an analysis and you are starting fresh with record classes, but starts showing a few chinks in the armor when you need to add a new table later, or modify a table. It becomes very hard keeping the UML in sync.

Andy discovered a new way to generate record classes, and it works great with a few exceptions. Unfortunately it doesn’t use any of the setting from the programming charters and generates everything with prefixes. Andy has likely show everyone this new method in his recent videos but I figured I would do a write up on the blog with some step by steps for everyone.

In this example we have a table in the Analysis called BudgetType that we need to create a record class for.

  1. In the project explorer at the bottom, you will see your analysis listed, right-click on the table and select “Generate a model Class”
  2. It pops up and wants to add to the SCM click cancel because we are going to rename it, etc. first
  1. That created a class that looks like this
  1. Remove the M in front of BudgetType and the line <MAPPING … stuff from the first line
  2. Important! Do not click save until you have done all of the below steps or it will confused things between logical name and file name
  3. Remove the french comments (unless you want to study your french) and the <MAPPING> line
  4. Click you mouse in front of the first <MAPPING … behind the variables
  5. Hold down the alt key while holding the left mouse button (you are now in column select mode) and select all the <MAPPING … stuff
  1. Press Delete
  2. Now use the same technique to remove all of the m_ from the front of the variables
  3. Remove the <END> line
  4. What you should have left looks like this
  1. From the Home ribbon bar do a File Save As
  1. Remove the M so it is called BudgetType
  1. Now Right click on the MBudgetType in the project explorer and delete it
  1. You Now have record class!!!

If you are generating a bunch of record classes the UML is definitely quicker, especially if you are using the wxPerts charter. But for a quick single record class this sure beats creating by hand, or dealing with other issues related to the UML. We have asked PCSOFT to please add logic so that this method follows the Charter rules, hopefully we can get that in a future release.

One thought on “Creating a record class without using the UML

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s