Flag

Description

Flags records by applying specified criteria

Syntax

Flag(<SelectionType>, <N>, <FlagExpression>, <FlagValue>, <NonFlagValue>, [SortExpression], [SortOrder], [Step])

Arguments

Argument Type Description Optional
SelectionType Text Specifies the method of selection to use No
N Text Specifies the number of records to select, either as a number, or as a percentage
If you wish to specify a percentage, then you should define this as text, enclosed in quotation marks, e.g. “75%”
Note:As of Loadit v2.15.23, this parameter can be specified as a Loadit expression.
No
FlagExpression Boolean Expression An expression that resolves to True/False to flag which records to select No
FlagValue Any A value to apply to flagged records No
NonFlagValue Any A value to apply to non-flagged records No
SortExpression Any An expression to sort the data on before flagging Yes
SortOrder Text Indicates whether to sort the data Ascending or Descending Yes
SortOrder Text Indicates whether to sort the data Ascending or Descending Yes
Step Number The number of records to increment by after each record is flagged Yes
Group Expression Any If specified, groups the data according to the expression and flags N(%) records per group Yes

SelectionType

Value Description
All Selects all records where FlagExpression = True
First Selects the first N(%) records where FlagExpression = true
Last Selects the last N(%) records where FlagExpression = true
Random Randomly selects N(%) records where FlagExpression = true

SortOrder

Value Description
Asc Sort Ascending
Desc Sort Descending

Returns

Determined by FlagValue / NonFlagValue

Examples

Expression: Flag("FIRST", "100", Gender = 'M', TRUE, FALSE, Age, "ASC", 1)
Returns: AAbb1