Working with Fields

  • Updated

Fields are the input elements that comprise the entity's data structure, along with rule calculations and rules. Fields, unlike calculations and rules, do not have dependencies on other fields, calculations, and rules. Field values are provided to the rule engine from the calling application or are entered by the user in the testing tool.

Beyond its name, data type, and default value, you can describe fields via other properties including field-level validations, UI control representation, notes, and associated categories.

Adding a field

Right-click on the element to which you want to add to. Select Add -> Field

mceclip0.png

Deleting a field

There are a few ways to do this:

  1. Right-click on the field you wish to delete, and select Delete.
  2. Click on the field you wish to delete and click Delete on the Home Banner.
  3. Click on the field you wish to delete and hit the [Delete]

You will be prompted to confirm the deletion. Click Yes.

Settings

mceclip1.png

Name

Specifies the name of the field. For fields that are based on an external source, this value may not be modified.

Display Name

Specifies the name that will be used in the business language editor when referring to this field.

Data Type

Specifies the data type of the field. The available options are:

  • Text
  • Integer
  • Date
  • DateTime
  • Decimal
  • Boolean
  • Complex
  • Entity

Entity

If "Entity" is selected for Data Type, the entity type is selected here. Parent Context If "Entity" is selected for Data Type, checking this box will allows rules running on field's entity type to reference fields on this entity, the parent.

Default Value

Specifies the default value of the field.

Default value may be specified for either value-type fields (text, integer, …) or entity fields.

For Entity Fields, Default Value checked specifies that the field should be instantiated / assigned when the containing entity is first instantiated. The XML state of the entity may be optionally specified to set its initial state when instantiated.

For fields of type date and datetime, default values must be prefixed and suffixed by a # character. e.g., #2/4/2004#, #2004-02-04#. Optionally time zone suffix can be specified such as #2004-02-04T01:03:00 -06:00# or #2004-02-04T07:03:00Z#

Value List

Any field may have a Value List associated with it, which is a list of values for the field – this list may optionally be set to constrain the valid values for the field at runtime via the “LimitToValueList” constraint.

Vocabulary

Clicking on the hyperlink will navigate to the Vocabulary folder for the entity in which this field is contained. Any field or entity may have one or more classifications associated with it, such as a “Young” classification for an “Age” field meaning < 30 years.

Rules

For fields that have a Data Type of "Entity", a Context rule set can be defined with the field to associate rules that are specific to the context in which the entity is used within the field.

Constraints

Any field may have one or more Constraints associated with it, which will automatically be enforced for any data that is set for the field. When a Constraint is violated, InRule triggers a validation message containing information about the field and Constraint that is in violation. Clicking on the Constraint hyperlink will navigate to the Constraints for the entity in which this field is contained. For fields that have a Data Type of Entity, this link is disabled.

Schema Source

Denotes from where the field is derived. Internal schema sources are those that are defined in irAuthor. External schema sources are imported from .NET assemblies, XML Schema or database schema.

Business Language

The business language section contains options for using the field in business language rules.

Uncheck the Include check box to make the field unavailable when writing business language rules, such as "If field is equal to value."

Uncheck the Allow assignment check box to make the field unavailable in any "Set field to value" business language rules.

Testing

If the Show in irVerify box is not checked, the field is not available when testing the rule application in irVerify.

Storage

The Storage section contains options that will impact a field's inclusion in entity state and runtime capabilities.

Temporary

Any element with this box checked will not be saved with Entity State. This check box is also available for collections and calculations. In schema bound rule applications checking this box indicates the element is not part of the bound model, and will not be removed after reloading any bound models.

Fields having the "Temporary" Storage setting checked can be thought of as "Entity scope" variables.

Fields, calculations, and collections set to the temporary state are not saved to the XML output file when saving Entity XML in irVerify; however, these elements can get saved to a Test Scenario output file via irVerify options.

Read Only

This is an authoring-time setting that enforces whether a Field may be modified at runtime. If the rule application is bound to a schema that indicates that the field is read only (e.g. only Get property exists for a .NET assembly bound schema) this checkbox will automatically be set to true.

During runtime, if either a rule or an SDK call attempts to set the value of a Field with this option selected, a ReadOnlyFieldException will be thrown.

The following are the only mechanisms by which initial data may be loaded into fields with this setting set to true. They must all result in a new Entity State being created as a result of their actions:

  • EntityState.Load() / EntityState.LoadXml()
  • AddCollectionMember Action
  • ExecuteSQLQuery Action
  • ExecuteWebService Action
  • ExecuteXPathQuery Action

The benefit of setting RuntimeReadOnly on a Field is improved performance when executing one of the following collection functions with a FilterBy and/or OrderBy option:

  • Aggregate functions (Count/Sum/Min/Max/Avg/Average)
  • CollectionLookup
  • GetMember
  • GetMemberValue
  • GetFirst
  • GetFirstValue
  • GetLast
  • GetLastValue
  • GetMemberByIndex
  • GetMemberValueByIndex
  • ExecuteMemberRuleSet Action

Related Topics

Working with Categories

 

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.