Table Fundamentals
65 For more information about these properties, see the C/SIDE Reference Guide online
Help.
To view or modify field properties:
1 Click Tools, Object Designer (SHIFT+F12).
2 In the Object Designer window, click Table to see a list of the tables.
AutoIncrement specify whether or not each field value is automatically given a new number that is greater than the number given to the previous value.
TableRelation define relationships to other tables. See the section "Setting Relationships Between Tables" on page 96 for a detailed description of how to create table relations.
ValidateTableRelation tell the system whether or not it should validate a table relationship.
TestTableRelation tell the system whether or not you want it to include this field when it tests the table relationships.
TableIDExpr specify the ID of the table to which you want to apply a table filter.
BlankZero define that the field will appear blank if the value is 0 (zero) or FALSE.
DataLength define the length of a data field.
OptionString define an option string (a comma-separated string of options). The maximum size is 1000 characters.
ClosingDates determine whether closing dates are allowed.
AutoFormatType determine how data is formatted.
AutoFormatExpr determine how data is formatted.
SignDisplacement shift negative values to the right for display purposes.
SQLDataType specify the data type you want to allow in a code field.
This property applies to code fields in the SQL Server Option for Navision.
ClearOnLookup tell the system to delete the current contents of the field before it adds the value the user selects via the lookup.
SubType define the subtype of a BLOB field, for example a Bitmap or a Memo.
Compressed specify whether or not a BLOB is compressed. This property only applies to BLOB fields and only on the SQL Server Option.
OptionCaption define the text string options that will be displayed to the user.
OptionCaptionML set the strings that will be displayed to the user for selecting an option.
OptionCaptionML is only used if the field has an OptionString property.
The OptionString property contains the set of values that are acceptable choices, and it is one of these values that will be saved in the database or used in C/AL code.
Property Name Use this property to...
Chapter 6. Table Fundamentals
66
3 Select a table and click Design to display it in the Table Designer:
4 Place the cursor on the line in the Table Designer that defines the field whose properties you want to access.
5 Click View, Properties (SHIFT+F4) to open the Properties window:
6 If you want to modify a property, simply enter the new value in the Properties window. When you have entered the new value, update the property by either pressing ENTER or simply moving the cursor away from the field.
7 To get Help for a property, select it in the Properties window and press F1.
EXAMPLE
The DecimalPlaces property is a typical example of a field property you may want to change.
When you create a new field of type Decimal, C/SIDE will assume that you want the value to be formatted as a currency. If your decimal field will not contain a currency, you can use this property to determine the number of decimal places that will appear on the screen. For example, in the G/L Entry table, the DecimalPlaces property of the Quantity field (Field No. 42) has been set to 0:5.
This means that the minimum number of decimal places you can enter is 0 and the maximum is 5.
6.3 Defining Keys
67
6.3 D
EFININGK
EYSThe Database Management System (DBMS) keeps track of each field by means of the field number, and the record's primary key. The primary key is composed of up to 20 fields in a record. The combination of values in fields in the primary key makes it possible for the DBMS to perform a unique identification of each record. The primary key determines the logical order in which records are stored, regardless of their physical placement on disk.
Logically, records are stored sequentially in ascending order, sorted by the primary key. Before adding a new record to a table, the DBMS checks that the information in the record's primary key fields is unique, and only then inserts the record into the correct logical position. Records are sorted "on the fly," so the database is always structurally correct. This allows fast data manipulation and retrieval.
A table description contains a list of keys. A key is a sequence of one or more field IDs from the table. Up to 40 keys can be associated to a table. The first key in the list is the primary key.
The primary key is always active and the DBMS keeps the table sorted in primary key order and rejects records with duplicate values in primary key fields. Therefore, the values in the primary key must always be unique. Be aware that it is not the value in each field in the primary key that must be unique, but rather the combination of values in all the fields comprising the primary key.
The C/SIDE database system does not support tables that do not have any keys.
How to Define a Primary Key
A maximum of 20 distinct fields can be used in a primary key definition. The number of fields in the primary key limits the number of fields in the other (secondary) keys.
When you create a table in the table designer, C/SIDE automatically uses the field with the lowest field number as the primary key.
To define a primary key:
To define a primary key:
1 Assume that you have created the following table in the Table Designer:
Chapter 6. Table Fundamentals
68
2 Click View, Keys to define a primary key. C/SIDE displays the Keys window:
3 In the first line in the Keys window, enter the primary key as a comma-separated list (for example: ID Number, Name).
How to Create Secondary Keys
Remember that up to 40 keys can be defined for a table, and that the first is the primary key. All the other keys are secondary keys and are optional. Secondary keys are used to view records in an order that is different from the order defined by the primary key fields.
To create a secondary key:
1 Click Tools, Object Designer (SHIFT+F12) and open your table in the Table Designer:
Define the primary key here
6.3 Defining Keys
69