-
Notifications
You must be signed in to change notification settings - Fork 13
Field Types
NOTE: this page is work-in-progress and is subject to change frequently
In this page:
- boolean
- integer
- decimal
- text
- textarea
- date
- datetime
- time
- url
- phone
- password
- formula
- html
- image
- document
- lookup
- multi-value lookup
- bitwise
- Custom Field Types
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.
These types are used for numeric values. Decimal can be stored as data type money or decimal. Integer can be smallint, int, bigint...
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.
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.
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.
Text value displayed as a text box in edit mode and hyperlink in other modes. These can be stored as varchar, or nvarchar.
Displayed as a text box in edit mode, with phone-compatible validation. To be saved in varchar or nvarchar columns.
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.
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
The "html" field type is used to display Rich Text Format (RTF) or HTML. It uses a WYSIWYG editor in the browser.
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.
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.
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.
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:
- Each field type would have a record in the database table (more info)
- 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/
- ...
- ...
- int/
- types/
Example: CRUDBooster similar implementation idea.
TBA
Copyright © Eitan Blumin 2018