I am having difficulty accessing report params on the backend in order to properly generate a report. I am able to generate a blank report. But the backend is not receiving the parameters from the angular tr-viewer
on the front I have a tr-viewer with params { MemberID: 59, Date: '3/31/2021', }
#totalReport1
[containerStyle]="viewerContainerStyle"
[serviceUrl]="'http://localhost:1088/api/reportapi/'"
[reportSource]="{
report: 'ReportAssetAllocation',
parameters: { MemberID: 59, Date: '3/31/2021' }
}"
[viewMode]="'INTERACTIVE'"
[scaleMode]="'SPECIFIC'"
[scale]="1.0"
[ready]="ready"
[viewerToolTipOpening]="viewerToolTipOpening"
[enableAccessibility]="true"
>
</tr-viewer>The report is generated in the C# constructor below
Please note that the way data is being fetched below was with a previous version of this application which used angularjs and took in the parameters through http headers.
public partial class ReportAssetAllocation : Telerik.Reporting.Report
{
public int MemberID { get; set; }
public string Date { get; set; }
public ReportAssetAllocation()
{
try
{
if (HttpContext.Current.Request.Headers.GetValues("memberID") != null)
{
MemberID = Convert.ToInt32(HttpContext.Current.Request.Headers.GetValues("memberID")[0]);
Date = Convert.ToString(HttpContext.Current.Request.Headers.GetValues("Date")[0]);
}
}
catch { }
InitializeComponent();
}I want to modify this constructor to accept the params from the Angular tr-viewer but I have not had any success in doing this after trying multiple methods from other posts and documentation.
What is best way to access these reportSource parameters { MemberID: 59, Date: '3/31/2021', } in my C# file?
For reference, here is the report api controller just in case:
public class ReportApiController : ReportsControllerBase
{
static readonly ReportServiceConfiguration preservedConfiguration;
static ReportApiController()
{
{
var resolver = new UriReportSourceResolver(HttpContext.Current.Server.MapPath("~/Reports"))
.AddFallbackResolver(new TypeReportSourceResolver()
.AddFallbackResolver(new TypeReportSourceResolver()));
preservedConfiguration = new ReportServiceConfiguration
{
HostAppId = "REPORTS",
ReportSourceResolver = resolver,
Storage = new Telerik.Reporting.Cache.File.FileStorage(),
};
var assemblyName = typeof(ReportCatalog).AssemblyQualifiedName;
var namespaceOfClass = typeof(ReportAssetAllocation).Namespace;
}
}
public ReportApiController()
{
this.ReportServiceConfiguration = preservedConfiguration;
}
}
Thank you