Hi Johny,
You are correct that the syntax for system variables like [%BeginOfCurrentDay%] can be different when used in XPath constraints for data widgets (e.g., data source constraint for a List) compared to visibility condition expressions. This is due to the context in which these expressions are evaluated.
1. Data Source XPath Constraint:
- When used as a data source XPath constraint, the expression is evaluated within the context of the entity that the data widget is displaying. In this context, the system variables need to be enclosed in single quotes (' ') to be treated as string literals. The single quotes indicate that the value is a string representation of the date or time.
Example:
[StartDateAndTime >= '[%BeginOfCurrentDay%]']
2. Visibility Condition Expression:
- On the other hand, when used as a visibility condition expression, the system variables are evaluated as expressions directly and do not need to be enclosed in single quotes. The system variable will be replaced with its actual value before evaluating the visibility condition.
Example:
$Match/StartDateAndTime < [%BeginOfCurrentDay%]
As for the relevant documentation, you can find information about using expressions in Mendix in the official Mendix documentation under the section "Expressions in Mendix":
Expressions in Mendix - Mendix Documentation
This documentation explains how expressions are used in various contexts, including data source constraints and visibility conditions, and provides examples of using system variables like [%BeginOfCurrentDay%].
In XPath constraints for data widgets, system variables are treated as string literals and need to be enclosed in single quotes, while in visibility conditions, system variables are evaluated as expressions without the need for single quotes.