reporting-docs/knowledge-base/use-useridentity-context-to...

1.6 KiB

title description type page_title slug position tags ticketid res_type
How to Use UserIdentity.Context to Pass Custom Objects to the Report How to use objects from UserIdentity.Context in Report Expressions how-to Passing Custom Objects to the Report with the UserIdentity.Context use-useridentity-context-to-pass-custom-objects-to-report 1459613 kb

Environment

Product Progress® Telerik® Reporting

Description

In some scenarios, it may be necessary to pass custom object values directly to the Report, without using [Global Objects]({%slug telerikreporting/designing-reports/connecting-to-data/expressions/expressions-reference/global-objects%}) as Report Parameters.

Solution

The UserIdentity object has a property Context that by default is Null. It is of type System.Collections.Concurrent.ConcurrentDictionary<string, object>. You may read more about how to pass a value to this property in the [How to use information from HttpContext in Custom Report Resolver]({% slug how-to-pass-information-from-httpcontext-to-reporting-engine %}) KB article. Then in the report, you may access the values of the collection.
For example, the first value of the collection may be used in an [Expression]({% slug telerikreporting/designing-reports/connecting-to-data/expressions/overview %}) like:

= Item(0, UserIdentity.Context.Values)

Note that you won't be able to access the property UserIdentity.Context.Values directly in the Expression editor of the Report Designers. You will have to type it manually.