It is a logical operator that returns True if the left operand value is equal to some of the values in the right operand.
Att | Var | VarBasedOnSDT.Property IN [(<comma-separated-constant-list>) | Collection | Array ]
Att IN Data Selector object
Where:
Att
Is an Attribute defined in the Knowledge Base.
Var
Is a scalar Variable defined in the GeneXus object where you are using the IN Operator.
VarBasedOnSDT.Property
Is a property of a Variable based on a Structured Data Type (SDT) object. Take into account that it must be a property of one element (if your definition is a collection).
Collection
Refers to attributes or variables based on Collection Domains or variables defined as collection with the same data type of the left operand.
Note: The first operand can't be an
expression (i.e "&numValue.ToString() IN &CharCollection" is not supported).
When the right operand is a list of constants delimited by a comma, the IN operand is equivalent to the expression: LeftOperand = FirstConstant OR LeftOperand = SecondConstant ...
When the right operand is a Collection or Array, the semantic is the same but the list varies depending on the elements the Collection or Array has in that specific execution.
In the case of In DataSelectors, see Data Selectors in For Each command.
- spc0075: Operand %1 does not match the data type of %2 in the IN comparison.
- spc0076: %1 must be a collection to be used as the right operand in an IN comparison.
- spc0077: %1's data type (%2) is not supported in an IN comparison.
If &element in &Collection
//do something
EndIf
For Each
where Attribute in &Collection
//do something
EndFor
For Each
where Attribute in DataSelector
//do something
EndFor
if &Message.Id in &ErrorCodesCollection //&Message is based on Messages.Message
//do something
Endif