skip to main content
Corticon Studio: Rule Language Guide : Rule operator details and examples : Trend
 

Try Corticon Now

Trend

SYNTAX

<Collection.attribute> -> <Sequence>.trend

DESCRIPTION

Returns one of the following 4-character strings depending on the trend of <Collection.attribute> once sequenced by the same or different attribute in <Collection>. <Sequence> is an ordered set of <Collection> in the form {x1, x2, x3 … xn}, where
INCR
the value of <attribute> of element xn+1 is greater than or equal to the value of <attribute> of element xn for every element. At least one <attribute> value of element x must be greater than that of xn-1
DECR
the value of <attribute> of element xn+1 is less than or equal to the value of <attribute> of element xn for every element. At least one <attribute> value of element x must be less than that of xn-1
CNST
the value of <attribute> of element xn+1 is equal to the value of <attribute> for element xn for every element.
NONE
any <sequence> with elements not meeting the requirements for INCR, DECR, or CNST
An alternative way to understand this operator is to view the index attribute used to sequence the collection as the independent variable (traditionally plotted along the x axis in a standard x-y graph) in a set of data pairs. The attribute evaluated by the .trend operator, <Collection.attribute>, is the dependent variable, plotted along the y axis. When so plotted, the 4-character words returned by .trend correspond to curves with positive, negative, zero (constant), or arbitrary slopes.

USAGE RESTRICTIONS

The Operators row of the table in Summary Table of Vocabulary Usage Restriction applies. No special exceptions.

RULESHEET EXAMPLE

This Rulesheet uses the .trend function to analyze integer1 attributes within collection1 sorted by decimal1. The resulting trend value is assigned to string1.

SAMPLE TEST

Two sample tests provide two collections of elements, each with a decimal1 and integer1 values. Input and Output panels are shown below.
Note: Technically, the slope of an INCR curve need not be positive everywhere, but must have a first derivative (instantaneous slope) that is positive at some point along the curve and never be negative. The slope of a CNST curve must be zero everywhere.