Report Rule Expression
General Expression
Check Count of Objects
The Count()
function or, Count
keyword is used to determine the number of elements within an object or collection. It's utilized without any parameters to count all elements or with specific conditions to count elements that meet certain criteria.
Example
To verify if the count of visuals in a collection named
Visuals
is greater than 3:
To check if visuals with a specific filter type exceed 4:
Check Bool Values
This expression compares a property or variable to a Boolean value (true
or false
) to evaluate a condition.
Example
To evaluate if a property
IsInUse
isFalse
:
Check Value is Null or Empty
The string.IsNullOrWhitespace(propertyName)
is a method used to check if a string variable named propertyName
is null, empty, or consists only of whitespace characters.
Example
To ensure
ShowAllRoles
is not null or empty:
Check Multiple Levels
This expression accesses properties or methods of nested objects by chaining their names together.
Example
To check if the count of fields in a single visual within the Config
object exceeds 7:
Check Value Contains Some Text
This expression checks if a string contains a specific sequence of characters.
Example
To verify if an object type contains the text "Measure":
Report Scope
When the score of the rule is set to Report
then, we can add/edit LINQ expression as shown in the following examples:
Examples
To retrieve the name property of the base theme used in the report:
To calculate the total number of pages within the report:
To verify whether the default cross-filtering behavior is set to true in the report configuration:
To check if there are any custom visuals present in the report by verifying the count of such visuals:
Page Scope
When the score of the rule is set to Page
then, we can add/edit LINQ expression as shown in the following examples:
Examples:
To check if the current page is hidden based on the configuration settings.
Verifies if there are more than two visuals present on the current page.
Check for the existence of any filters applied at the page level.
Assesses whether there is any visual on the page with a width greater than 500 units.
Verifies if all visuals across all pages have a width greater than 500 units.
Visual Scope
When the score of the rule is set to Visual
then, we can add/edit LINQ expression as shown in the following examples:
Examples:
Check if the name property of visual matches the specified name "Visual Name".
Examines whether there are any filters applied at the visual level.
Last updated