Field Class

Assembly: CodeEffects.Rule.Editor.dll
Namespace: CodeEffects.Rule.Editor.Client

Summary

Represents a field or property of the source object in an Adaptive Source. A source holds its fields in the Fields property of Source. The class carries the same information as the FieldAttribute does in a source object class.

Syntax

public class Field : Item, IDataTypable, IPromptable, IFilterable

Field inherits DisplayName, Value, Description, AiAliases, AiDescription, Nullable, and ResetsContext from Item.

Constructors

  • Field()

    Creates a field with these defaults: DataType is DataType.None, ValueInputType is ValueInputType.All, IsRule and Prompt are false, Settable and Gettable are true, and Collection and Settings are new objects with their own defaults.

Properties

  • DataType

    Type: CodeEffects.Rule.Common.Models.DataType

    The data type of the field. For a field of a collection type, set it to DataType.Collection and describe the collection in Collection. For time fields, see Settings.TimeType. The default value is DataType.None.

  • ValueInputType

    Type: CodeEffects.Rule.Common.Models.ValueInputType

    Defines how users may set the value of the field in a rule: pick other fields only, type a value only, or both. The default value is ValueInputType.All.

  • IsRule

    Type: System.Boolean

    Marks the field as a reusable rule: the field stands for a reusable rule, and its Value is the ID of that rule. The default value is false.

  • Settable

    Type: System.Boolean

    Indicates whether the field can be set by a setter in the execution section of a rule. The default value is true.

  • Gettable

    Type: System.Boolean

    Indicates whether the field can be read in the condition section of a rule. The default value is true.

  • Prompt

    Type: System.Boolean

    Implements IPromptable. When true for a string field, the Rule Editor shows its Prompt dialog for long-form input, as described in AI Prompts. It has no effect on other data types. The default value is false.

  • Filter

    Type: System.String

    Implements IFilterable. The filter value of the field. A field with a data source shows only the DataSourceItem objects whose Filter matches this value.

  • Group

    Type: System.String

    The name of the group the Rule Editor shows the field under in its menus. Fields without a group are shown ungrouped.

  • Collection

    Type: Collection

    The collection settings of the field. Used only when DataType is DataType.Collection.

  • Settings

    Type: Settings

    Implements ISettable. The type-specific settings of the field, such as the range, the date and time format, TimeType, and the data source name.

Methods

  • ToString(bool isAdativeSource)

    Returns: System.String

    Returns the field as the JSON object that the Rule Editor sends to the client. The Rule Editor calls this method; you do not need to. The parameter name is spelled this way in the API.

Example

using CodeEffects.Rule.Common.Models;
using CodeEffects.Rule.Editor.Client;

var field = new Field
{
	Value = "Shipment.TransitTime",
	DisplayName = "Transit Time",
	DataType = DataType.Time,
	Settings = new Settings
	{
		TimeType = TimeType.Duration,
		Format = "d.hh:mm"
	}
};

Ask on Stack Overflow - Yes, it's still active
Ask in GitHub Discussions

p102

l097 --

l102

p101

×