Controls whether encrypted fields are decrypted when returned via API.
When true:
When false:
false (secure by default)
Optional property that provides the display name for the field, if null, use the Name property. The DisplayNameOrName() method is a helper function that does this for you with a single method call.
When true, this field will be encrypted at rest using the specified EncryptionKeyID. Encrypted fields:
false
References the encryption key to use when Encrypt is true. Must point to an active record in the "MJ: Encryption Keys" entity. Required if Encrypt is true.
Foreign key to the Entities entity.
Primary Key
If true, the field is the primary key for the entity. There must be one primary key field per entity.
If true, the field is a unique key for the entity. There can be zero to many unique key fields per entity.
When AllowDecryptInAPI is false, controls what value is returned to clients.
When true:
When false:
false (most secure)
The sequence of the field within the entity, typically the intended display order
Private _codeFor fields in the database that have characters invalid for SQL identifiers in them, we need to replace those characters with _ in order to create variables for stored procedures. This property returns a consistent CodeName you can use everywhere to refer to the field when generated variable names
Private Static Readonly SQL_Readonly array of SQL Server date/time functions that return the current date/time
Returns the DisplayName if it exists, otherwise returns the Name.
Returns true if the field has a default value set
Returns true if the field type is a binary type such as binary, varbinary, or image.
Returns true if the field is the CreatedAt field, a special field that is used to track the creation date of a record. This is only used when the entity has TrackRecordChanges=1
Returns true if the field is the DeletedAt field, a special field that is used to track the deletion date of a record. This is only used when the entity has DeleteType=Soft
Helper method that returns true if the field is one of the special reserved MJ date fields for tracking CreatedAt and UpdatedAt timestamps as well as the DeletedAt timestamp used for entities that have DeleteType=Soft. This is only used when the entity has TrackRecordChanges=1 or for entities where DeleteType=Soft
Returns true if the field is a uniqueidentifier in the database.
Returns true if the field is the UpdatedAt field, a special field that is used to track the last update date of a record. This is only used when the entity has TrackRecordChanges=1
Returns true if the field type requires quotes around the value when used in a SQL statement
Returns true if the field type requires a Unicode prefix (N) when used in a SQL statement.
Returns a string with the full SQL data type that combines, as appropriate, Type, Length, Precision and Scale where these attributes are relevant to the Type
Returns true if the field is a "special" field (see list below) and is handled inside the DB layer and should be ignored in validation by the BaseEntity architecture Also, we skip validation if we have a field that is:
Provides the TypeScript type for a given Entity Field. This is useful to map a wide array of database types to a narrower set of TypeScript types.
Returns the Unicode prefix (N) if the field type requires it, otherwise returns an empty string.
Returns the ValueListType using the EntityFieldValueListType enum.
Formats a value based on the parameters passed in. This is a wrapper utility method that already know the SQL type from the entity field definition and simply calls the generic FormatValue() function that is also exported by @memberjunction/core
Value to format
Number of decimals to show, defaults to 2
Currency to use when formatting, defaults to USD
Maximum length of the string to return, if the formatted value is longer than this length then the string will be truncated and the trailingChars will be appended to the end of the string
Only used if maxLength is > 0 and the string being formatted is > maxLength, this is the string that will be appended to the end of the string to indicate that it was truncated, defaults to "..."
either the original string value or a formatted version. If the format cannot be applied an an exception occurs it is captured and the error is put to the log, and the original value is returned
Protected copyCopies initialization data from a plain object to the class instance. Only copies properties that already exist on the class to prevent creating new fields. Special handling for DefaultValue fields to extract actual values from SQL Server syntax.
The initialization data object
Static AssertThis static factory method is used to check to see if the entity field in question is active or not If it is not active, it will throw an exception or log a warning depending on the status of the entity field being either Deprecated or Disabled.
the EntityFieldInfo object to check the status of
the name of the caller that is calling this method, used for logging purposes such as EntityField::constructor as an example.
Static Is
List of all fields within each entity with metadata about each field. Includes data types, relationships, defaults, and UI display preferences.