Defining Entity Fields

The information you enter on a Fields record determines the type of field that appears on the form that Aptify automatically generates for the entity. These field types generally correspond to Aptify bound controls. Note that non-updateable fields (that is, fields with the Updateable option is cleared) do not appear on generated form but they can be added to a form manually using the Visual Designer (see Modifying Field Layout with the Visual Designer for more information).

This topic contains the following sub-topics that provide general instructions for creating a new field, describe the configuration settings required for a field to adopt a particular field type, and provide a listing of supported SQL data types:

Common Entity Field Types

The common entity field types include:

  • Standard Text Field: This is a standard text field.
  • Multi-Line Text Field: This is a text field that supports multiple lines, such as a Description field.
  • Check Box: This is a checkbox that a user can select or clear.
  • Date Selection Field: This field stores a date and time; it includes a calendar icon so users can scroll through the calendar to select a date.
  • Link Box: This field provides a link to another entity. Typically, a linked field links to another entity's ID field. This field creates a foreign key and establishes a one-to-many relationship between the new entity and the related entity. However, since the link is based on ID, you generally also want to create a Joined Virtual Field for linked fields so the linked record's name appears in views rather than its ID.
  • Standard Combo Drop-down List: This field displays a list of static field values.
  • Data Combo Drop-down List: This field displays a list of field values, populated with records from another entity or database table. This drop-down menu can display one or more fields for each selection.
  • Extended Attribute Fields: Aptify supports 16 extended field types. This includes address-related fields (such as a State or ZIP Code field) and field that present an icon that provides additional functionality when clicked (such as an Email or Object Repository field).
  • Embedded Objects: As with a Link Box, this type of field provides a link to another entity and establishes a one-to-many relationship between the new entity and the related entity. However, when using an embedded object, the fields from the related entity appear on the new entity's form, as if they were fields in that entity. See Embedded Objects for more information.
  • Calculated and Computed Virtual Fields: This is a field that is not stored in the database table. The system dynamically calculates the field's value based on a specified SQL expression at either the table level (Computed) or within the Base View (Calculated).
  • Money Fields: A money field typically should be expressed in a particular currency type. This section describes how to configure a field and specify that its values can support multiple currencies.

Field Types Illustrated

See Selecting Fields for information on how to use the standard field types.

Developers can refer to the Aptify.Framework.WindowsControls namespace in the Aptify Software Development Kit (SDK) for more information on the Aptify bound controls. 

General Steps for Creating a Field

The following steps describe the basic procedure for creating a new Fields sub-type record in an entity:

For complete information on all of the Field options, see About the Fields Form

  1. Open a new Fields record in the entity.
  2. Enter a name in the Name field.
    • Aptify creates a column in the database table with the specified name. Therefore, a field's Name cannot contain spaces or dashes.
    • Two fields within the same Entity cannot have the same field Name.
  3. The Display Name field populates automatically when you click off of the Name field. Modify this value as necessary.
    • The system uses the Display Name as the label for the field on a generated form. In other words, this is the name that users will see.
    • The Description field on the Info tab also populates automatically with the value you specified in the Name field.
  4. Assign the field to one of the entity's tables, by selecting a table from the Base Table drop-down list.
    • If you only have one table, then that table appears in the Base Table field and the field is grayed out.
    • See Creating Multiple Base Tables for information on setting up multiple base tables.

    Fields Record Top Area

  5. If you are using localization, specify the culture string that corresponds to this field's name in the Display Culture String field. This field is optional; see Using Localization Administration for more information.
  6. Configure the Linked Entity and Linked Entity Field fields, if necessary.
    • If you are creating a Link Box or Data Combo Drop-down List, you can specify link information in the Linked Entity and Linked Entity Field fields. Also, set Link Type to Standard.
    • If you are creating an Embedded field, specify link information in the Linked Entity and Linked Entity Field fields and set Link Type to Embedded. See Creating Embedded Objects for details.
  7. Configure the Field's General tab. See General Tab for field information.
    • If a Base Field exists for the field you are creating, select the Base Field from the drop-down list. See Using Base Fields for more information.
    • Configure the field's SQL Server settings, including SQLData TypeSQLField Size, and Allow Null. See About the Supported SQL Data Types for information on the supported data types.
  8. If you are creating a Standard Combo Drop-down List or Data Combo Drop-down List, configure the Field's Values tab. Refer to these two field types or Values Tab for more information.
  9. Configure the Field's Options. See Options Tab for more information.
    • To create a virtual field (such as a joined, calculated, or computed virtual field), clear the In Table option to display the Virtual Field tab. See Joined Virtual Field, Calculated and Computed Virtual Fields in Virtual Field Tab for more information.
    • Note that a non-updateable field (that is, a field with the Updateable option unchecked), will not appear on a form that is automatically generated by the system.
    • If you select the Is Name Field option to specify that the field is the entity's Name field, the system automatically clears the from the Allow Null option on the General tab and selects the Is Required option on the Validation tab.
  10. Configure the Field's Validation options. See Validation Tab for more information.
  11. Configure the Field's Security options. See Security Tab for more information.
  12. Configure the Field's Info options. See Info Tab for more information.
  13. Click OK to save and close the Fields record.

Creating a Field of a Specific Type

This section describes the configuration settings required in order for a field to adopt a particular field type on a generated entity form. For each field type, follow the steps in General Steps for Creating a Field and modify the Fields record as described in each section below.

Standard Text Field

To create a standard text field, configure the following options:

  • SQLDataType: Use a data type that corresponds to a string value, such as char or nvarchar.
  • SQLFieldSize: Use a field size of 255 or less.

Multi-Line Text Field

To create a multi-line text field, configure the following options:

  • SQLDataType: Use a data type that corresponds to a string value, such as char, nchar, varchar, or nvarchar. For large fields, use nvarchar(max) or varchar(max).

  • SQLFieldSize: Use a field size greater than 256 (or max, for nvarchar(max) and varchar(max)).

  • Category: If you want a large text field to appear as its own tab without a separate field caption, enter the field's Name in the Category field. If no other fields are in the same category, Aptify will create a separate tab for this field that does not include a field caption.
    • In the example shown in the figure below, the multi-line Details field is displayed on a separate Details tab.
    • Note that this functionality is only applicable if the Category value equals the field's Name and no other fields are in the same category.

  • Text Interpretation Mode: This option is found on the Options tab. For plain text fields, leave this option set to None. To specify that this field stores text in rich text format, specify RTF. To specify that this field stores HTML text, set this option to HTML.
    • When set to None, Aptify adds this field to a generated form as a standard multi-line text field. See Multi-Line Text Field for more information.
    • When set to RTF, Aptify adds this field to a generated form as a Rich Text Field part. See Rich Text Field for more information.
    • When set to HTML, Aptify adds this field to a generated form as an HTML Field part. See HTML Text Field for more information. 

      Multi-Line Text Field As a Tab

Check Box

To create a check box, configure the following option:

  • SQLDataType: Use a data type of bit. A value of 1 corresponds to a checked box, and a value of 0 corresponds to an unchecked box.

Date Selection Field

To create a date/time field that includes the calendar icon, configure the following option:

  • SQLDataType: Use a data type of datetime or date.
  • Default Value: If desired, enter a default value for the date/time field.
    • Aptify's supports the GETDATE() function that returns the current date or date/time combination depending on the chosen data type. Note that the GETDATE function only returns the date element of a DateTime field.
    • Starting with 5.5, Aptify supports using the function GETDATETIME to populate both the date and timestamp of fields of type DateTime.

Time Field

To create a time field that does not include a date component, configure the following option:

  • SQLDataType: Use a data type of time.
  • Default Value: If desired, enter a default value for the time field.
    • Aptify's supports the GETDATE() function that returns the current time.
    • Starting with 5.5, Aptify also supports using the function GETDATETIME to populate both the date and timestamp of fields of type DateTime.

A link box provides a link to another entity, typically to the other entity's ID field. This field creates a foreign key in the database and establishes a one-to-many relationship between the new entity and the related entity. To create a link box, configure the following option:

  • Name: Aptify's standard naming convention for link boxes is the name of the linked entity (in its singular form) and the linked entity field. For example, the name of a field linked to the Applications entity's ID field would be ApplicationID.
  • Display Name: Specify the name that you want users to see as the link box's caption on generated forms.
  • Linked Entity: Select an entity from the drop-down list.

    When you save a linked field for the first time, a message box appears asking if you want to create a virtual field for the linked field. See Joined Virtual Field for details. Likewise, when you delete a linked field and one or more virtual fields exist for the linked field, a message box appears asking you if you want to delete the virtual fields as well.

  • Linked Entity Field: Select a field in the Linked Entity from the drop-down list; this field is used as the foreign key. In general, the Linked Field is the ID field of the Linked Entity. However, other fields also appear in the drop-down list. To qualify as a Linked Field, a field in a related entity must meet the following criteria:
    • The Linked Field must be a primary key (the ID field) or a unique key in the Linked Entity. (This is a SQL Server requirement.)
    • The field in the Linked Entity must have the Is Required option selected. (This is an Aptify requirement.)
  • Values Tab: You only need to configure the Values tab if you want to enable the Multiple Selection dialog for In List filters. See Values Tab for details.
  • Options Tab: Do not select the Default in View if you intend to create a Joined Virtual Field.
  • Validation Tab: To create a required foreign key, select the Is Required field; a user will need to specify a value for the link box before he or she can save a new record in this service. To create an optional foreign key, clear the Is Required field; a user does not need to specify a value for the link box before saving a new record in this service.

If you want to support NULL for an optional foreign key, you must also select the Allow Null option on the field's General tab. In this case, Aptify stores NULL in this field if a user does not specify a value. If you do not select Allow Null for an optional foreign key, Aptify stores 0 in this field if a user does not specify a value. 

The example in the figure below illustrates a field that is linked to the Application entity's ID field.

Adding a Link Box Field

Joined Virtual Field

In a view, the value of the field shown in the above figure will be the ID of the Applications record that the user enters into the link box. To display a different field from the Linked Entity in a view (such as the Applications record's Name field), you need to add a virtual field to the entity. Aptify automatically adds virtual field information to an entity's Base View.

Aptify includes a wizard that assists with the creation of joined virtual fields. You can use this wizard or manually create the field yourself.

Using the Wizard to Create a Joined Virtual Field

The Aptify Entity Virtual Fields dialog appears automatically each time you save a new field that has a value selected for the Linked Entity field. You can also launch this dialog at any time by clicking the Add Virtual Fields... icon in the Fields tab's toolbar.

Add Virtual Fields Icon

Follow these steps to create a joined virtual field using the dialog:

  1. Create a Link Box or Data Combo Drop-down List field and click OK to save and close the Fields record.
    • A message dialog appears automatically.

      Create Virtual Field Message Dialog
  2. Click Yes to open the Aptify Entity Virtual Fields dialog.
    • You can also open the dialog at any time by clicking the Add Virtual Field... icon in the Field tab's toolbar. Note that an entity must have at least one linked field before the dialog will open.
  3. If the entity's Fields list has more than one linked field, select the linked field for which you want to create a virtual field from the Linked (Foreign Key) Field drop-down list.
    • The wizard loads and displays all of the fields from the entity linked to the field you selected.
    • If the linked field you created in Step 1 is the first or only linked field in the entity, the wizard loads and displays all of the fields from that linked entity automatically and the Linked (Foreign Key) Field is grayed out.
    • If one or more virtual fields already exist for the linked field, these existing virtual fields are grayed out within the wizard. Note that you cannot modify the settings for an existing virtual field within the wizard; in this case, you need to edit the corresponding Fields record.
    • The Is Required column helps you identify which of the fields are required to save a record in the related entity. You can ignore this column when creating a virtual field for a Standard link. (This column is important for Embedded links — see Understanding the Embedded Object Model for details).
  4. Select the Create column for each field for which you want to create a virtual field.
    • Typically, you want to create a virtual field for the linked entity's Name or Display Name field.
    • When you select the Create column for a field, the wizard also selects the Default In View column automatically.
  5. If you do not want the Virtual Field to appear in views by default, clear the Default In View column option.
  6. Enter a name for the field in the Virtual Field field.
    • Aptify's standard naming convention for virtual fields associated with a linked entity field is the name of the link box field plus _Name. For example, the virtual field for an ApplicationID link box would be named ApplicationID_Name.
    • The name cannot contain spaces or dashes.
  7. Specify the name that you want users to see as this field's column heading in a view in the Display Name field.
  8. Enter a Description for the virtual field (optional).

    Aptify Entity Virtual Fields Dialog
  9. Click OK to create the field.
    • The virtual field is added to the entity's Fields list.
    • If you want to review the virtual field's configuration, you can open the new Fields record.
  10. Add any additional fields and save and close the entity.

    • The virtual field information is automatically added to the entity's base view.

When you create a joined virtual field using the wizard, Aptify automatically sets the virtual field's Join Type to Required or Optional depending on whether or not the linked field is required.

Note that if you modify the Is Required option for a linked field at a later date, the system does not automatically update the Join Type for that field's virtual fields. In this case, you need to manually edit the Join Type for each virtual field related to the linked field you modified. 

Manually Create a Joined Virtual Field

Open a new Fields record and configure the following fields:

  • Name: Aptify's standard naming convention for virtual fields associated with a link box is the name of the link box field plus _Name. For example, the virtual field for an ApplicationID link box would be named ApplicationID_Name. The name cannot -contain spaces or dashes.
  • Display Name: Specify the name that you want users to see as this field's column heading in a view.
  • SQL Server settings: You do not need to specify these settings since this field will not be in the table. However, typically the SQL Data Type and SQL Field Size should be the same as the field to which the virtual field refers.
  • Options Tab: Configure the following options:
    • In Table: Clear the In Table option under the Options tab. A Virtual Field tab displays automatically.
    • Default In View: Select the option to display the virtual field in list views of this entity by default.
  • Virtual Field Tab: Configure the following fields on this tab:
    • Virtual Field Type: Select Joined.
    • Joined Entity: Select the entity that appears in the link box's Linked Entity field.
    • Joined Field: Select the field from the Joined Entity whose value you want to display in views.
    • Join Foreign Key: Enter the name of the corresponding link box field you created (such as ApplicationID). This field fills in automatically when you specify a Joined Entity.
  • Join Type: Select a Join Type. In general, use Optional for if the related linked field is not required and Required if the related linked field is required.

Virtual Field Setup

The above describes how to create a virtual field for a corresponding linked entity (link box) field. Note that the you can also use virtual fields for other purposes, such as creating a calculated field. See Virtual Field Tab for additional options.

Standard Combo Drop-down List

To create a combo drop-down list field, configure the following options:

  • Top Area and General Tab: Configure the fields in these areas as necessary.
  • Values Tab: Configure the following:
    • GUIType Single Select: Select Supported.
    • Value List Type: Select Static List.
    • Values Sub-Type: Add one Values sub-type record for each possible field value. In the example shown in the figure below, the static list contains the Active and Inactive values. These are the values that will appear in the drop-down list on the generated form. Note that the values enter in the value list can not exceed the SQL Field Size for the specified field. You can also localize the values associated with a standard comb drop-down list. See Localizing Standard and Data Combo Value Lists for more information.

Drop Down Field Setup

Data Combo Drop-down List

A Data Combo drop-down field displays a list of records from another table in the database. A field of this type may or may not be linked to a field in another entity.

You should use this control if you want to provide users with a drop-down list of pre-populated items from another table or entity. By specifying a SQL statement, you define the drop-down's list contents and you can display more than one column from the corresponding table or entity.

The example in the figure below shows a data combo drop-down field that displays the records from the Applications service. In this example, the Application's ID and Name appear in the drop-down list. When a user selects one of the applications from the list, the system stores the Application's ID as the contents of this field and displays the Application's Name within the field when displayed on the form.

Sample Data Combo Box
Use the following settings to create a data combo drop-down list:

  • Top Area and General Tab: Configure the fields in these areas as necessary.
    • SQLData Type and SQLField Size: Configure the SQL Server settings for this field to match the type of data that will be returned by the SQL statement you specify on the Values tab.
    • Linked Entity (optional): If you want to link this field to an existing entity, select an entity from the drop-down list. Otherwise, you can leave this blank.

When you save a linked field for the first time, a message box appears asking if you want to create a virtual field for the linked field. See Joined Virtual Field for details. Likewise, when you delete a linked field and one or more virtual fields exist for the linked field, a message box appears asking you if you want to delete the virtual fields as well.

    • Linked Entity Field (optional): If you configured Linked Entity, select a field in the Linked Entity from the drop-down list; this field is used as the foreign key. In general, the Linked Entity Field is the ID field of the Linked Entity. Otherwise, you can leave this blank. Note that for a field to qualify as a Linked Field, it must meet the following criteria:
    • The Linked Field must be a primary key (the ID field) or a unique key in the Linked Entity. (This is a SQL Server requirement.)
    • The field in the Linked Entity must have the Is Required option is selected. (This is an Aptify requirement.)
  • Values Tab: Configure the following settings:
    • GUIType Single Select: Select Supported.
    • GUIType Multi Select: If you want to enable the Multiple Selection dialog for In List filters, select Supported - Standard. Otherwise, you can leave this set to Not Supported.
    • Value List Type: Select SQL Statement.
    • Values Sub-Type: Add one Values sub-type record for this field. Enter the SQL statement to execute in the Values record's Value field.
      • For example, the following SQL statement returns the ID and Name of Applications records: SELECT ID,Name FROM APTIFY.dbo.vwApplications
      • A Data Combo Box form component includes a ValueField input property that determines which of the fields returned by the SQL statement is saved to the database. If the ID field is specified in the SQL statement, the Form Template Generator specifies the ID as the ValueField. If the ID field is not specified, the Form Template Generator uses the first field specified in the SQL statement.
      • Note that in the example above, the data combo field's SQL Data Type and SQL Field Size should match the settings for the Applications entity's ID field since that data value will be stored for the field. The field's SQL Data Type and SQL Field Size should match the values for the Data Combo Box's ValueField.
      • A Data Combo Box form component also includes a DisplayField input property that determines which of the fields returned by the SQL statement to display as the value on the form. If a Name field is specified in the SQL statement, the Form Template Generator specifies the Name as the DisplayField. If a Name field is not specified, the Form Template Generator uses the second field specified in the SQL statement. If only one field is specified in the SQL statement, then the Form Template Generator uses that field as the DisplayField.
      • During the entity save process, the system will prompt you if it detects an invalid SQL statement in a Values sub-type record.
      • You can also localize the values associated with SQL-sourced data combo boxes. See Localizing Standard and Data Combo Value Lists for more information.
    • Validation Tab: If marked as Required, the data combo box defaults to the first record in the list for new records. If marked as Not Required, the data combo box default to blank and the blank option remains available in the drop-down list.

See About the Visual Designer Data Combo Box for more information on Data Combo Box component's Input Properties.

 

Data Combo Box Setup

Extended Attribute Fields

Aptify provides 17 extended field types. You can assign one of these extended types to a field to enable additional functionality for that field on the entity's generated form.

For example, if you mark a field with the WebURL Extended Type, an Internet Explorer icon appears next to the field on the entity's generated form. When a user enters a Web page in this field and clicks the icon, Internet Explorer opens to the page specified in the field.

To add extended functionality to a field, configure all necessary options for the field and then select the desired type from the Extended Type drop-down list.

Specifying an Extended Type for a Field
See Extended Type for the complete list of Extended Types.

Calculated and Computed Virtual Fields 

Calculated and Computed Fields are virtual fields that do not exist as fields in a database table. These fields use a specified transact-SQL expression to derive the value from other fields in Aptify. For Calculated Fields, this expression can include any field in the current entity, as well as subqueries to fields in other entities. For Computed fields, this expression can only reference fields that are in the same Base Table as the Computed field (that is, the entity's primary Base Table).

Aptify dynamically calculates the field's value either at the table level (for Computed fields) or within the Base View (for Calculated fields). Note that since virtual fields are not In Table, these fields are also not Updateable. Therefore, Calculated or Computed fields do not appear on generated forms.

Follow these steps to create a Calculated or Computed field:

  1. Open a new Fields record in the entity.
  2. Enter a name in the Name field.
    • A field's Name cannot contain spaces or dashes.
  3. The Display Name field populates automatically when you click off of the Name field. Modify this name as necessary.
    • The system uses the Display Name as the label for the column heading in list views. In other words, this is the name that users will see.
    • The Description field on the Info tab also populates automatically with the value you specified in the Name field.
  4. If creating a Computed field, specify the entity's primary base table in the Base Table. Note that the fields that will be referenced in the Computed field's SQL expression must also reside in the primary base table.
    • A Computed field and all of the fields that are referenced in its calculation must be in the entity's primary base table. See Creating Multiple Base Tables for information on using multiple base tables.
    • You can skip this step if creating a Calculated field, since these fields are not associated with a particular table.

    Fields Record Top Area

  5. If you are using localization, specify a the culture string that corresponds to this field's name in the Display Culture String field. This field is optional; see Localization for more information.
  6. Configure a SQL Data Type under the General tab, if desired.
    • For virtual fields, Aptify uses this selection to determine the appearance of the field within the viewing system. For example, if the virtual field performs a mathematical operation on currency fields, you may want the virtual field to display as a currency value. In this case, you would set the SQL Data Type to Money.
  7. Click the Options tab.
  8. Clear the In Table option to display the Virtual Field tab.
  9. Click the Virtual Field tab.
  10. Select Calculated or Computed from the Virtual Field Type drop-down list.
    • Calculated: Indicates that the virtual field is calculated from other values, including values from fields in other entities. The information is not stored in the database table but the relevant information is added to the entity's Base View.
    • Computed: Indicates that the virtual field is calculated from other values within the same table. Unlike a Calculated field, which is calculated within an entity's Base View, a Computed field is calculated at the entity's primary database table. Note that a Computed field is not a physical field in the table even the Computed field appears in the table details when viewed using SQL Server Management Studio. You cannot create a constraint or an index for a computed field. (Aptify does not create Persisted computed columns.)
  11. Enter the SQL expression that defines the value for the virtual field in the Calculated or Computed field.
    • This expression may include mathematical or string operations on one or more fields. For Calculated fields, it can include any field in the current entity as well as subqueries to fields in other entities. For Computed fields, the expression can only reference fields that are in the entity's primary Base Table, which you -specified in the Field's top area.
    • When Virtual Field Type is set to Calculated, the text in the Calculated Field appears in the SELECT section of the base view once the entity is saved. When Virtual Field Type is set to Computed, the text in the Computed Field is stored in the field's specified base table.

      Calculation Field

  12. Click OK to save and close the Fields record.
  13. Save the entity.

Money Fields

In Aptify, a field that uses the money or smallmoney SQL Data Type can be expressed in one or more currencies, if the form also includes a CurrencyTypeID linked field. Then, when a user specifies a value for money field on an entity's record, Aptify automatically expresses that value in the selected Currency Type, using the appropriate currency symbol.

Follow these steps to add a money field that can be expressed in multiple currencies:

  1. If one does not already exist, add a CurrencyTypeID linked field to the entity.
    • When configuring a money field that supports multiple currencies, you must specify the CurrencyTypeID linked field that will define the field's currency type. This can be either a linked field in the current entity or its parent (if a sub-type entity).
  2. Open a new Fields record in the entity.
  3. Enter a name in the Name field.
    • A field's Name cannot contain spaces or dashes.
  4. The Display Name field populates automatically when you click off of the Name field. Modify this name as necessary.
    • The system uses the Display Name as the label for the column heading in list views. In other words, this is the name that users will see.
    • The Description field on the Info tab also populates automatically with the value you specified in the Name field.
  5. Select money or smallmoney from the SQLData Type drop-down list.
    • The Supports Multiple Currencies option box becomes enabled.
  6. Select the Supports Multiple Currencies option.
    • The Currency Type Field becomes enabled.
    • If you leave this option cleared, this money field is currency-agnostic (in other words, values in this field will not be treated as having a particular currency type).
  7. Select a pre-existing CurrencyTypeID linked field from the set of available fields in the Currency Type Field drop-down list.
    • This field displays the set of available CurrencyTypeID fields already configured for this entity and its parent entity (for sub-type entities). Therefore, you must add one or more CurrencyTypeID linked fields to the entity before adding any multi-currency money fields.
    • When a user specifies a currency type on the entity's record, Aptify automatically knows that a value specified in this money field is expressed in the specified currency.

      Configuring Money Field

  8. Continue configuring the field as necessary. See General Steps for Creating a Field for more information.

About the Supported SQL Data Types

Aptify supports the following SQL data types:

 

Selecting a Field's SQL Data Type

 

SQL Data Types

Description

bigint

A field of this data type can store an integer value from -2^63 (-9223372036854775808) through 2^63-1 (9223372036854775807). The SQL Field Size for a field of this type is 8 bytes.

bit A bit field supports a value of 0 or 1. This field type is suitable for enable/disable or true/false flags. The Aptify Baseline Form Template Generator displays bit fields using the check box form component.
char

A char field stores character strings consisting of letters, numbers or symbols. Char fields are fixed width and do not support the unicode character set. Char fields support a single character set that is specified during SQL Server setup. The maximum field size for a char field is 8000 characters (or 8000 bytes, 1 byte per character). However, since this is a fixed width field type, you should configure the field to use the smallest field size necessary given the type of information you intend to store in this field. Compare this data type with nchar and varchar. For fields that require more characters, use nvarchar(max) or varchar(max).

When designing entities that contain large fields, keep in mind that the maximum size of each record or row in a SQL server table is 8060 bytes. Therefore, the maximum size of all fields in a particular table should not exceed this limit. If necessary, you can specify sub-tables for your entity to store one or fields. See Creating Multiple Base Tables for details.

Note Concerning Microsoft SQL Server 2008: Microsoft SQL Server 2008 relaxes the restrictions of the maximum record size for certain field types. See Row-Overflow Data Exceeding 8 KB in the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms186981(v=sql.105).aspx) for more information.

date A field of this type stores a valid date. This type of field does not store a time component. A date field requires 3 bytes and supports a date range from 1/1/1000 to 12/31/9999. Note that the date data type is new to Microsoft SQL Server 2008.
datetime A field of this type stores a valid date and time combination. A datetime field requires 8 bytes and supports a date range from 1/1/1753 to 12/31/9999.
decimal A field of this data type can store a decimal value. In SQL Server and Aptify, the decimal and numeric data types provide the same functionality. When you select one of these data types, you must also specify the SQL Field Precision (the number of digits in the number) and SQL Field Scale (which is the number of digits in the number that appear to the right of the decimal point). See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information on these data types.
float A field of this data type stores a floating point approximate numeric value. In Aptify, the storage size of a float field is 8 bytes, which supports 15 digits. See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information on floating point data types. Also, see real for more information.
int A field of this data type can store an integer value from -2,147,483,648 through 2,147,483,647. The SQL Field Size for a field of this type is 4 bytes.
money A field of this type can store a money value up to four decimal places (if your field requires more decimal places, use the decimal or numeric data type instead). The money type uses 8 bytes of storage and supports a data range from -922,337,203,685,477.5808 through +922,337,203,685,477.5807. Compare with smallmoney. Also, see Money Fields for information on how to specify that a money field supports multiple currencies.
nchar

An nchar field stores unicode character strings consisting of letters, numbers or symbols. Nchar fields are fixed width and can support a maximum of 4000 characters. (Unicode characters require 2 bytes per character.) However, since this is a fixed width field type, you should configure the field to use the smallest field size necessary given the type of information you intend to store in this field. Compare this data type with char and nvarchar. For fields that require more characters, use nvarchar(max) or varchar(max). 

When designing entities that contain large fields, keep in mind that the maximum size of each record or row in a SQL server table is 8060 bytes. Therefore, the maximum size of each field in a particular table should not exceed this limit. If necessary, you can specify sub-tables for your entity to store one or fields. See Creating Multiple Base Tables for details.

Note Concerning Microsoft SQL Server 2008: Microsoft SQL Server 2008 relaxes the restrictions of the maximum record size for certain field types. See the Microsoft SQL Server Books Online for more information about run-overflow data.

ntext

An ntext field stores large unicode character strings. Prior to SQL Server 2005, this data type was typically used for fields that required more than 4000 unicode characters or if a table needed to store multiple large fields. Beginning with SQL Server 2005, Microsoft has introduced nvarchar(max), which eliminates the need to use ntext fields (Microsoft has indicated that ntext will be removed from a future release of Microsoft SQL Server). See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information.

While Aptify continues to support ntext for backwards compatibility, all of the large fields in Aptify 4.x and 5.x use either nvarchar(max) or varchar(max). For existing entities, you should migrate all ntext fields to nvarchar(max) whenever feasible, and for all new entities, you should use nvarchar(max) rather than ntext.

Note that SQL Server and Aptify do not support sorting view results by an ntext field, so ntext fields do not appear in the Sort by drop-down list on a view's Sorting tab. Also, a user cannot filter records based on an ntext field. Therefore, ntext fields do not appear in the Field drop-down list when creating view filters or using the Find dialog.

numeric A field of this data type can store a decimal value. In SQL Server and Aptify, the decimal and numeric data types provide the same functionality. When you select one of these data types, you must also specify the SQL Field Precision (the number of digits in the number) and SQL Field Scale (which is the number of digits in the number that appear to the right of the decimal point). See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information on these data types.
nvarchar

An nvarchar field stores unicode character strings consisting of letters, numbers or symbols. The actual size of an nvarchar field varies depending on the amount of data entered in the field. The SQL Field Size you specify sets the maximum number of characters that can be entered for a field of this type. In any case, an nvarchar field cannot exceed 4000 characters (unicode characters require 2 bytes per character). Compare this data type with nchar and varchar. For fields that require more characters, use nvarchar(max) or varchar(max). Note that nvarchar is the default SQL Data Type when you open a new Fields record.

When designing entities that contain large fields, keep in mind that the maximum size of each record or row in a SQL server table is 8060 bytes. Therefore, the maximum size of each field in a particular table should not exceed this limit. If necessary, you can specify sub-tables for your entity to store one or fields. See Creating Multiple Base Tables for details.

Note Concerning Microsoft SQL Server 2008: Microsoft SQL Server 2008 relaxes the restrictions of the maximum record size for certain field types. See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information about row-overflow data. 

nvarchar(max) An nvarchar(max) field is a special case of the nvarchar data type that stores a large amount of unicode characters consisting of letters, numbers or symbols. Introduced in Microsoft SQL Server 2005, nvarchar(max) stores and retrieves large unicode character sets more efficiently than ntext. Aptify recommends that you use nvarchar(max) for all fields that you previously would have designated as ntext. See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information on this data type.
real A field of this data type stores a floating point approximate numeric value. In Aptify, the storage size of a real field is 4 bytes, which supports 7 digits. See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information on floating point data types. Also, see float for more information.
smalldatetime

A field of this type stores a valid date and time combination. A smalldatetime field requires 4 bytes and supports a date range from 1/1/1900 to 6/6/2079. 

smallint A field of this data type can store an integer value from -32,768 through 32,767. The SQL Field Size for a field of this type is 2 bytes.
smallmoney A field of this type can store a money value up to four decimal places (if your field requires more decimal places, use the decimal or numeric data type instead). The smallmoney type uses 4 bytes of storage and supports a data range from -214,748.3648 through 214,748.3647. Compare with money. Also, see Money Fields for information on how to specify that a money field supports multiple currencies.
text

A text field stores large character strings. Prior to SQL Server 2005, this data type was typically used for fields that required more than 8000 characters or if a table needed to store multiple large fields. Beginning with SQL Server 2005, Microsoft has introduced varchar(max), which eliminates the need to use text fields (Microsoft has indicated that text will be removed from a future release of Microsoft SQL Server). See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information.

While Aptify continues to support text for backwards compatibility, all of the large fields in Aptify 4.x and 5.x use either nvarchar(max) or varchar(max). For existing entities, you should migrate all text fields to varchar(max) whenever feasible, and for all new entities, you should use varchar(max) rather than text.

Note that SQL Server and Aptify do not support sorting view results by a text field, so text fields do not appear in the Sort by drop-down list on a view's Sorting tab. Also, a user cannot filter records based on a text field. Therefore, text fields do not appear in the Field drop-down list when creating view filters or using the Find dialog.

time A field of this data type stores a valid time without a date component. A time field requires 5 bytes and should be specified in the HH:MM:SS format. Note that the time data type is new to Microsoft SQL Server 2008.
tinyint A field of this data type can store an integer value from 0 through 255. The SQL Field Size for a field of this type is 1 byte.
uniqueidentifier

A field of this data type corresponds to a globally unique identifier (GUID). A GUID is a 16-byte number that is unique for each record. It is represented by 32 hexadecimal digits (0 - 9 and A - F) in the following format: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.

A sample GUID is shown in the figure below.

Sample GUID
When adding a uniqueidentifier field to an Entities record, an administrator can enter NEWID as the field's Default Value . With this default value, Aptify automatically generates a GUID and populates this field for any record that does not already have a GUID.

Setting NEWID Default Value
Unless a GUID has been automatically generated (by setting the field's Default Value to NEWID), a user must specify one of the following values for a uniqueidentifier field when creating a record:

  • Blank: When a unique identifier field is left blank, Aptify automatically stores a Null value in the database for that field (assuming that the field is not required).
  • A valid GUID: Any non-blank value specified by the user must be a GUID in the appropriate hexadecimal format. Note that you can optionally use brackets ({ }) to enclose the GUI (for example, {C31A15DA-D5BA-4560-8A36-D11CA601EFE1}).

See Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information on the uniqueindentifier data type and the NEWID function.

varbinary A varbinary field stores binary data. The actual size of a varbinary field varies depending on the amount of data entered in the field. The SQL Field Size you specify sets the maximum possible size of the field. The maximum field size for a varbinary field is 8000 bytes. For fields that require more characters, use varbinary(max).
varbinary(max)

A varbinary(max) field is a special case of the varbinary data type that stores a large amount of binary digits. See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information on this data type.

When designing entities that contain large fields, keep in mind that the maximum size of each record or row in a SQL server table is 8060 bytes. Therefore, the maximum size of each field in a particular table should not exceed this limit. If necessary, you can specify sub-tables for your entity to store one or fields. See Creating Multiple Base Tables for details.

Note Concerning Microsoft SQL Server 2008: Microsoft SQL Server 2008 relaxes the restrictions of the maximum record size for certain field types. See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information about row-overflow data.

varchar

A varchar field stores character strings consisting of letters, numbers or symbols. The actual size of a varchar field varies depending on the amount of data entered in the field. The SQL Field Size you specify sets the maximum possible size of the field. Varchar fields support a single character set that is specified during SQL Server setup; they do not support the unicode character set. The maximum field size for a varchar field is 8000 characters (or 8000 bytes, 1 byte per character). Compare this data type with char and nvarchar. For fields that require more characters, use varchar(max).

When designing entities that contain large fields, keep in mind that the maximum size of each record or row in a SQL server table is 8060 bytes. Therefore, the maximum size of each field in a particular table should not exceed this limit. If necessary, you can specify sub-tables for your entity to store one or fields. See Creating Multiple Base Tables for details.

Note Concerning Microsoft SQL Server 2008: Microsoft SQL Server 2008 relaxes the restrictions of the maximum record size for certain field types. See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information about row-overflow data. 

 varchar(max) A varchar(max) field is a special case of the varchar data type that stores a large amount of characters consisting of letters, numbers or symbols. Introduced in Microsoft SQL Server 2005, varchar(max) stores and retrieves large character sets more efficiently than ntext. Aptify recommends that you use nvarchar(max) for all fields that you previously would have designated as text. See the Microsoft SQL Server Books Online (https://technet.microsoft.com/en-us/library/ms130214(v=sql.105).aspx) for more information on this data type.

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.