Data Dictionary Interface

Top  Previous  Next

The templates use information from the Data Dictionary extensively to generate code specifically for the declared database. There are several symbols that specifically give the templates access to all the declarations: %Dictionary, %File, %Field, %Key, and %Relation. These, and all the symbols related to them, give the templates access to all the information in the Data Dictionary.

Pay special attention to the %DictionaryUserOptions, %FileUserOptions, %FieldUserOptions, %KeyUserOptions, and %RelationUserOptions symbols. These are the symbols that contain the values the user enters in the User Options text control on the Options tab of the Dictionary Properties, File Properties, Field Properties, Key Properties, and Relation Properties dialogs. This can be a powerful tool to customize any output from the Data Dictionary.

The best way to use these User Options symbols is to set them up so the user enters their custom preferences which your template supports in the form of attributes with parameters, with each attribute separated by a comma. This gives them the same appearance as Clarion language data structure attributes. By doing this, you can use the EXTRACT built-in template procedure to get the value from the user. For example, if the user enters the following in a User Options for a field:

 

       MYCUSTOMOPTION(On)

 

The template code can parse this using EXTRACT:

 

       #IF(EXTRACT(%FieldUserOptions,'MYCUSTOMOPTION',1) = On)

        #!Do Something related to this option being turned on

       #ENDIF

 

This is a very powerful tool, which allows for infinite flexibility in the way your custom templates generate source code.