Table of Contents
< All Topics
Print

Item Type Properties

Item Type Properties model Application Data and Logic.

A Property has a data type for defining the stored data, similar to a column for a table in Excel and relational databases. However, a Property also has a Label, Description, Constraints, and other attributes specific to the data type.

The Expression Property Type can be used to model Item Type Logic. The Property can be referenced in Gnosis Script as a function on the Item Type.

Item Types can have as many properties as needed to describe and model the business item.

Property Attributes

A Property has a Name, Label, Description, Data Type, Constraints, and other attributes specific to the data type.

Name

The Property Name can contain only letters, digits, and underscore symbols, starting with a letter or underscore.

It is customary to use Pascal casing when naming properties.

Label

The Property Label allows a brief string to describe the Property that will enable spaces. It is the label text for fields in the No-code auto-format Views.

Gnosis will automatically split Pascal casing into space-separated words, capitalizing the first letter in each word.

Description

A brief string that describes the Property’s purpose is used as the empty text for fields in the No-code auto-format Views.

Data Type

Gnosis supports all the standard data types you expect, such as string, integer, date, etc., and a few special ones.

Array

An array of data of any type.

Boolean

A true or false value.

You can assign the Boolean true with any number other than zero (0) or the keyword true. You can assign the Boolean false with 0 or the keyword false.

The default string format for a Boolean is Yes and No text for true and false values. The following shows how to format a Boolean value:

// No string formating.
[true, false].Map(x => x)

Results in:

[ true, false ]
// Fomat true|false as a string.
[true, false].Map(x => ToString(x))

Results in:

[ "true", "false" ]
// Default format Yes|No.
[true, false].Map(x => ToString(x, ''))

Results in:

[ "Yes", "No" ]
// Custom format On|Off.
[true, false].Map(x => ToString(x, 'On|Off'))

Results in:

[ "On", "Off" ]
// -> arrow substitution format shortcut.
[true, false].Map(x => "{x -> ON|OFF}")

Results in:

[ "ON", "OFF" ]

Complex

A Property Type reference. A Complex Property Type forms a One-to-One relationship.

Date

Dates are stored as a DateTime with zero time.

DateTime

DateTime is stored as a 64-bit integer representing the number of milliseconds since the Unix epoch (Jan 1, 1970.)

Decimal

This is a 128-bit float that supports 34 decimal digits (i.e., significant digits) and an exponent range of −6143 to +6144.

You can use the Decimal Precision option to control the decimal places, the default for two.

Document

A binary file of any type.

Email

A valid email formatted string.

Expression

An Expression property is a Gnosis Script.

The Expression value is not stored in the database. It is evaluated every time the Item Property is referenced (though it is cached until the end of the Script transaction to avoid redundant evaluations).

Expression can be a Function to represent Item instance method (e.g. for implementing an Event Handler), which can be called with arguments, where the first argument is the target Item.

Since derived Item Types automatically inherit properties, this approach allows for Application Logic inheritance. Derived Item Types can override the Expression and use the $Base variable to call the base Item Type Expression.

Float

A float (or Double) is a positive or negative number with a decimal point but without exact, consistent precision.

HTML

A max string for holding HTML markup. The No-code UI automatically renders the HTML.

Identifier

A unique textual identifier based on an auto-increment counter and custom formatting.

Identifier Attributes

Seed—The starting number to start incrementing.

Increment—The number to increment for each new Item.

Prefix or Format—The Raw Template String to format the identifier value.

$Value variable

The $Value variable holds the current value for the identifier. The identifier format is a Raw Template String (without the enclosing triple double quotes).

{$ItemType}-{$Value -> 00000}

Identity

A reference to an Identity.

Identity Attributes

Scope Team—The Team Identity constraint. Only Members for the Identity are valid.

Integer

An integer is a whole number without any fractions or decimals that can be positive, negative, or zero, ranging from -2,147,483,647 to 2,147,483,647 for 9 or 10 digits of precision.

Long

A long integer number ranging in value from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

Money

A decimal value with currency formatting.

Object

A dictionary object.

PickList

PickList properties reference Item Types, creating a relationship between the Item with the PickList property and the Item referenced by the PickList property.

PickList properties are lightweight One-to-Many relationships.

Unlike the Relationship and Link Types, where the Parent property is the master of the relationship, the Item for the PickList property is the master in this relationship.

Reference

A Reference is a special PickList referencing the reserved Parent and Child properties used in Relationship and Link Types. Gnosis manages Reference properties automatically.

String

A valid UTF-8 textual value. The maximum size is 16MB (16777216 bytes). Up to 700 characters can be indexed.

String Attributes

Length—String length constraint.

Max—Allow maximum string size constraint.

Time

Time is stored as a String in HH:MM:SS 24h format.

The format for the time value when creating or updating the Item can be HH:MM AM|PM.

User

Reference to a User.

Scope Team—The Team Identity constraint. Only User Members for the Identity are valid.

URL

A valid URL formatted string. The No-code provides a configurable UI control for viewing the page.

Collection

This is a read-only collection of Relationship or Link-Type items. To add items to the collection, create new Relationship and Link items, and to remove items from the collection, delete the Relationship and Link items.

Data Type Attributes

Depending on the Property data type, additional attributes can be used to control how the Property can be used. Is it required? Is it a unique value? Is the default value? Are there check constraints?

Allow blank

Unselect the Allow blank values option to configure the Property as required.

  • Disabled for Expression, Identifier, Complex, and Override data types.

Auto recalculate

The Auto recalculate option is enabled when the Dynamic Default Value is set.

With the Auto recalculate set, the Default Value Expression value is neither stored in the database nor cached in the current Script transaction. It will be evaluated whenever the Item Property value is referenced. So, the value is not cached for the Script transaction.

When Auto recalculate is set, the Dependencies options are enabled, which allows you to define the Item Types to watch for Item changes.

  • Disabled for Expression, Identifier, Document, PickList, Identity, User, Complex, Reference, and Override data types.

Dependencies

When Auto recalculate is set, the Dependencies options are enabled, which allows you to define the Item Types to watch for Item changes.

You define an Expression for the watch Item Type to return an array of Items requiring the Default Value Expression to be evaluated.

This allows the evaluated value to be stored in the database and can be searched while dynamically assessing the property value as needed.

Recalculate On Update

On Item Update, the Default Value value will be evaluated and stored in the database.

Item Type

Recalculating the Default Value may depend on when other Items change.

Add the Item Types to watch for Item changes.

When an Item for the specified Item Type is updated, the Items to recalculate Expression is evaluated.

Items to recalculate

Items to recalculate Expressions are evaluated when an Item for the specified Item Type to watch is updated. The Expression must return the array of Items that require the Default Value to be evaluated, and the value is stored in the database.

The modified items for the Item Type being watched are accessible in the Expression as variables:

$ModifiedItems—The list of modified items.

$ModifiedType—The ItemType of those modified items.

$ItemType—The ItemType for the Property.

Decimal Precision

The decimal precision is the number of digits from the right where the decimal point is placed in Decimal data type properties.

  • Enabled for Float, Decimal, and Money data types.

Dynamic Default Value

When the Dynamic Default Value is set, and the property’s value is null or unspecified on creation, the Default Value is not evaluated and stored in the database as normal. The value null is stored in the database for the Property Item. The Default Value is evaluated when the Property value is requested.

The Property value must explicitly be set to null on Item updates to keep the Dynamic Default Value evaluation. As long as the Property value is stored as null in the database, the Default Value is evaluated when the Property value is requested.

The value is cached until the end of the Gnosis Script transaction to avoid redundant evaluations.

The Auto recalculate option becomes enabled when the Dynamic Default Value is set. This allows the evaluated value to be stored in the database while dynamically assessing the property value as needed.

  • This is disabled for the Expression, Identifier, Document, Identity, User, Complex, Reference, Checkbox Group, Grid, and Override data types.

Encrypted

The value will be encrypted at rest.

  • Enabled for String, HTML, Email, URL, and PhoneNumber data types.

Internal

An Internal property is only accessible on the server side. It is excluded from all API responses and the No-code auto-format Views.

  • Disabled for the Override data type.

Max Value

The maximum value allowed constraint.

  • Enabled for Integer, Long, Float, Decimal, and Money data types.

Min Value

The minimum value allowed constraint.

  • Enabled for Integer, Long, Float, Decimal, and Money data types.

Read-only

The Read-only attribute prevents the Property value from being changed after initially being set. The value can be set by the Default Value and in server-side logic if the value is null.

  • Disabled for Expression, Identifier, Complex, and Override data types.

Reference Type

The Item Type constraint for the PickList and Complex data types. Only items of the specified type are valid values.

  • Enabled for PickList, Complex, CheckboxGroup, and Grid data types.

Unique

The value must be unique across the Item Type.

You can configure the value to be unique across Archived items, Relationship items, and all items derived from the same base Item Type.

  • Disabled for Expression, Identifier, HTML, Document, Complex, Override, and Object data types.

Unique Relationship

The value must be unique across Relationship items. If not set, the Parent reference is part of the unique key.

Unique Derived

The value must be unique across all items of the current Item Type and the base Item Type (if the base Item Type has this setting ON for the Property, then its base Item Type is also included).

Unique Archived

The value must be unique, including Archived items.

Default Value

The Default Value is used when the Property value is not provided when an Item is created. It is also applied when an Item is updated, and a null value is provided for the Property. So, if the Property value is null when creating or updating the Item, then the Default Value is used and stored in the database as the value for the Item Property.

The Default Value is a Raw Template String (without the enclosing triple double quotes).

To prevent errors, you should avoid using properties in their Default Value expressions that use each other. In such a case, at least one value should be provided during Item creation to skip Default Value substitution.

Check Constraints

Properties can have a Check Constraint Expression that defines custom check expressions for more complex cases not covered by Property Attribute constraints.

A custom check expression is a regular expression with special context variables $Value and $Property.

For example, the following Expression prevents a value from being greater than the Account Balance value for the Item:

$Value <= $Item.AccountBalance
    or Error('Amount cannot be greater than Account Balance.')

Expressions can generate custom error messages using the Error() function.

The Check Constraint Expression is applied after all standard constraints but before the unique constraint check.

View State

The View State dictionary defines additional property attributes used by the No-code Views to configure and control the UI.

The naming convention for the dictionary key is the View Type under-bar the View Name:

${ViewType}[_{ViewName}]

Here is the list of keys for a View State:

{
	$Items = { // Items type View settings
	},
	$New = { // New type View settings
	},
	$Update = { // Update type View settings
	},
	$Read = { // Read type View settings
	},
	$Custom_Read = { // settings for Custom type named Read View
	},
	$All = { // settings for all Aiews
	},
	$AllRead = { // settings for all Read type Views
	},
	$AllEdit = { // settings for all New and Update types Views
	},
	anyDynamicKey = expression, // all dynamic state keys go directly in dict
}

The value is a dictionary of UI configuration settings.

{
	$Items = {
		flex = 1
	},
	$Read = {
		asSummary = true,
		hideLabel = true,
		fieldCls = 'title-field',
		'@.display.format' : '? , [<b>//<\\/b> = ][<i>]<br>'
	},
	style = {
		color = Priority?.Name == 'High'
			? 'red'
			: Priority?.Name == 'Low'
				? 'blue'
				: 'orange'
	}
}

$Edit variable

The $Edit variable will be true for New and Update types Views. It can be used in dynamic View State properties.

The following example will set the UI control to disabled if the View is New or Update type, and the Disable Property is also set to true:

{
  disabled = $Edit ? Disabled : missing
}