Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update user-functions.md #1605

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,22 @@ There are two ways to utilize user functions:

`= Telerik.Reporting.Report.Report1.ResolveUrl("~/Images/Logo.jpg")`

If the loaded assembly contains many __public static__ (__Public Shared__ in VB.NET) methods, this might produce some clutter in the Edit Expression dialog, when browsing for existing user functions. To overcome this problem, you can use the IsVisible attribute to hide any methods, which are not intended to be used as user functions. See the code example below:
If the loaded assembly contains many __public static__ (__Public Shared__ in VB.NET) methods, this might produce some clutter in the Edit Expression dialog, when browsing for existing user functions. To overcome this problem, you can use the IsVisible attribute to hide any methods, which are not intended to be used as user functions. See the code sample below:

__Example:__

{{source=CodeSnippets\CS\API\Telerik\Reporting\Expressions\UserFunctionsSnippets.cs region=UserFunctionsAttributeIsVisibleSnippet}}
{{source=CodeSnippets\VB\API\Telerik\Reporting\Expressions\UserFunctionsSnippets.vb region=UserFunctionsAttributeIsVisibleSnippet}}

## User Functions Visibility in Report Designers

As of 2025 Q1 (19.0.25.211), the __User Function__ resolution behavior has been changed. The `IsVisible` property of the `Function` attribute can now be used to more precisely control which functions are loaded by the Reporting Engine. Below you can find more information about the new behavior:

* By default, all public static methods in the chosen assembly(ies) are loaded;
* If at least one public static method in the assembly(ies) is decorated with the `Function` attribute and has its [IsVisible](/api/telerik.reporting.expressions.functionattribute#Telerik_Reporting_Expressions_FunctionAttribute_IsVisible) property set to `True` _(true by default)_, only public static methods with the same configuration will be loaded. Public static methods that are not decorated with the `Function` attribute or have their [IsVisible](/api/telerik.reporting.expressions.functionattribute#Telerik_Reporting_Expressions_FunctionAttribute_IsVisible) properties set to `False`, will not be loaded.
* If a type is decorated with the `Function` attribute and has its [IsVisible](/api/telerik.reporting.expressions.functionattribute#Telerik_Reporting_Expressions_FunctionAttribute_IsVisible) property set to `False`, none of the methods in this class will be loaded.
* If a type is decorated with the `Function` attribute and has its [IsVisible](/api/telerik.reporting.expressions.functionattribute#Telerik_Reporting_Expressions_FunctionAttribute_IsVisible) property set to `True`, all methods in it, except for the ones decorated with `IsVisible = False`, will be loaded.

## Providing metadata for functions

You can provide descriptive metadata about your user functions through attributes. Attributes are specialized classes that are applied to code elements. At compile time, attributes are emitted into metadata that is available to the common language runtime and reporting engine.
Expand Down