Skip to content

Field Types

Eitan Blumin edited this page Apr 21, 2019 · 1 revision

NOTE: this page is work-in-progress and is subject to change frequently

In this page:

boolean boolean

Boolean fields are Yes/No values displayed as checkboxes. A Boolean field is stored as a numeric value (Yes=1, No=0 or null). The most efficient database column type for it is bit.

numeric integer, decimal

These types are used for numeric values. Decimal can be stored as data type money or decimal. Integer can be smallint, int, bigint...

text text

This type is the most commonly used one. It is displayed as a text box in edit mode. It is a string stored as varchar or nvarchar.

textarea textarea

Fields of these types are displayed as big text boxes (HTML "textarea") and can spread over several rows. They can be stored as text, varchar, or nvarchar.

date and time date, datetime, time

Dates are displayed as an input box with a date picker in edit mode, and as a formatted string in other modes. The Javascript for the date picker is an external JS file which can be customized. Possible database column types are datetime or smalldatetime.

email email, url

Text value displayed as a text box in edit mode and hyperlink in other modes. These can be stored as varchar, or nvarchar.

text phone

Displayed as a text box in edit mode, with phone-compatible validation. To be saved in varchar or nvarchar columns.

text password

Displayed as a password text box in edit mode. To be saved in varchar or nvarchar columns. Password text boxes do not display their current value when editing an existing record.

formula formula

SQL formula or sub-query. The calculation SQL is entered in the DBColumn field. Fields of type formula cannot be edited by users.

Example formula: SELECT COUNT(*) FROM Photos P WHERE P.albumid=T.id

rich text format html

The "html" field type is used to display Rich Text Format (RTF) or HTML. It uses a WYSIWYG editor in the browser.

image image

Images are displayed as such in view mode, as a box with a browse button for upload in edit mode, as a checkbox in the search and advanced search modes. Images are stored on the file server, only the filename is stored in the database, as a varchar or nvarchar.

document document

Documents are displayed as a link for download in view mode, as a text box with a browse button for upload in edit mode, as a checkbox in the search and advanced search modes. Like images, documents are stored on the file server and only the filename is stored in the database.

lov dropdown, multi-selection dropdown

Lists of values are choices of values displayed as drop-down lists in edit mode or as the string of the selected value in view mode. They correspond to joins to secondary tables in the database and are stored in the driving table as a number which is the primary key of the value in the secondary table.

Multi-selection dropdown lets you select more than one value from the list of values. The list of selected values will be saved as a comma-separated list (for example: "1, 3, 15, 12"). Therefore the corresponding DBColumn data type should be varchar or nvarchar.

Bitwise is similar to multi-selection in function, but instead of concatenating the selected values with commas, the values are added mathematically. The column data type must be integer compatible (smallint,int,bigint). The bitwise values must be powers of 2. For example: 1, 2, 4, 8, 16, 32... This way any sort of integer value can be broken down into a unique collection of its bitwise components. For example: the integer number 1234 can be uniquely broken down into: 1024+128+64+16+2 To learn more about bitwise numbers and how to use them, click here.

Custom Field Types

Hopefully, it should be possible to relatively easily extend CRUDE's functionality by creating new, custom field types.

This would be thanks to the generic implementation of the portal's field types. Specifically:

  1. Each field type would have a record in the database table (more info)
  2. Each field type would use several "partial" asp files which would determine its behavior:
    • view.asp (determines how the field type be implemented in the View component)
    • edit.asp (determines how the field type be implemented in the Edit component)
    • tablecell.asp (determines how the field type be implemented as a datatable cell)
    • actionparam.asp (determines how the field type be implemented as an action parameter)

The files will be located in a folder structure such as this:

  • site root/
    • types/
      • int/
        • view.asp
        • edit.asp
        • ...
      • text/
        • view.cshtml
        • edit.cshtml
        • ...
      • money/
        • ...
      • ...

Example: CRUDBooster similar implementation idea.

TBA