Hi I'm working on a webproject and using telerik reporting to display custom reports.
I have the following Solution Structure..
-Solution
+ Web Project (Web)
+ Class Library (Reports)
I have designen a report that takes dynamic parameters and builds multivalue parameters from what has prev been selected.
So in the report i have a first parameter Page, page is not a multivalue. When a page is selected say you select ID 5, the second parameter takes the selected value and calls and stored procedure with the first parameters value as a parameter passed to the sp. Here everything is ok. However when it comes to the second parameter which is a multivalue. I have choosen so that the third parameter takes the selected values of the second and calls an sp with the values. To get the values i am using a userfunction like below
In the Report Preview & Html Preview this works perfect and everything is displayed and bound as it should be..
However when migrating this report to my web solution I have the following setup.
Enheter.ascx
Backend
This is just because I want to set some parameters before making the report..
Everything shows up as it should but when trying to select a value inside my second parameter , the third parameter who uses my userfunction displays the following error.
the third parameter datasource is an sp with the following parameters inserted -> = FormatArray(Parameters.survFieldsGroup.Value)
Parameters.survFieldsGroup being the second parameter.
It seems the report doesnt know where the userfunction is when it has been migrated to the reportbook.
How can i fix this?
Anders
I have the following Solution Structure..
-Solution
+ Web Project (Web)
+ Class Library (Reports)
I have designen a report that takes dynamic parameters and builds multivalue parameters from what has prev been selected.
So in the report i have a first parameter Page, page is not a multivalue. When a page is selected say you select ID 5, the second parameter takes the selected value and calls and stored procedure with the first parameters value as a parameter passed to the sp. Here everything is ok. However when it comes to the second parameter which is a multivalue. I have choosen so that the third parameter takes the selected values of the second and calls an sp with the values. To get the values i am using a userfunction like below
public static string FormatArray(object[] array) { StringBuilder sb = new StringBuilder(); foreach (object o in array) { if (sb.Length > 1) { sb.Append(", "); } sb.Append(o.ToString()); } return sb.ToString(); }In the Report Preview & Html Preview this works perfect and everything is displayed and bound as it should be..
However when migrating this report to my web solution I have the following setup.
Enheter.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Enheter.ascx.cs" Inherits="Web.controls.Reports.Enheter" %><%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=5.0.11.316, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %><telerik:ReportViewer ID="ReportViewer1" runat="server" Width="100%" Height="700px" ></telerik:ReportViewer>Backend
Report myReport = new Rapporter.K2.Report1(); myReport.ReportParameters["nkod"].Value = nkod; myReport.ReportParameters["sysID"].Value = BaseLogic.GlobalSystemID.intSystemID; using (CoreEntities db = new CoreEntities(clsBaseLogic.SqlConnEntityString)) { myReport.ReportParameters["strEnhet"].Value = db.tblTree_item.SingleOrDefault(k => k.intTreeItemID == nkod).strTreeItem; myReport.ReportParameters["strPeriod"].Value = db.tblCore_Period.SingleOrDefault(k => k.intPeriodID == BaseLogic.intPeriodID).strDescription; } ReportBook book = new ReportBook(); book.Reports.Add(myReport); ReportViewer1.Report = book;This is just because I want to set some parameters before making the report..
Everything shows up as it should but when trying to select a value inside my second parameter , the third parameter who uses my userfunction displays the following error.
The expression contains undefined function call FormatArray().at Telerik.Reporting.Expressions.FunctionNode.Eval(Object row, Object context)at Telerik.Reporting.Processing.Data.MultidimensionalQueryProvider.Evaluate(Object value, Object data)at Telerik.Reporting.Processing.Data.SqlQueryProvider.GetEvaluatedParameters()at Telerik.Reporting.Processing.Data.SqlQueryProvider.GetCommandParameters(Boolean evaluateParameters)at Telerik.Reporting.Processing.Data.SqlQueryProvider.CreateCommand(IDbConnection connection, Boolean evaluateParameters)at Telerik.Reporting.Processing.Data.SqlQueryProvider.CreateCommand(IDbConnection connection)at Telerik.Reporting.Processing.Data.SqlDataEnumerable.d__0.MoveNext()at Telerik.Reporting.Processing.Data.ResultSet.SeedData(IEnumerable`1 rawData)at Telerik.Reporting.Processing.Data.ResultSet.Fill(IEnumerable`1 data)at Telerik.Reporting.Processing.Data.SqlQueryProvider.Execute(MultidimensionalQuery query)at Telerik.Reporting.Processing.ParametersManager`1.GetAvailableValuesData(ReportParameterAvailableValues availableValuesDef, ExpressionNode valueExpression, MultidimensionalQueryProvider& provider)at Telerik.Reporting.Processing.ParametersManager`1.CalculateParameterValues(T parameter, ReportParameter parameterDef, IDictionary`2 parameterValues)at Telerik.Reporting.Processing.ParametersManager`1.Calculate(T parameter, IDictionary`2 parameterValues)at Telerik.Reporting.Processing.ParametersManager`1.CalculateChildren(T parameter, IDictionary`2 parameterValues)at Telerik.Reporting.Processing.ParametersManager`1.Calculate(T parameter, IDictionary`2 parameterValues)at Telerik.Reporting.Processing.ParametersManager`1.CalculateChildren(T parameter, IDictionary`2 parameterValues)at Telerik.Reporting.Processing.ParametersManager`1.Calculate(T parameter, IDictionary`2 parameterValues)at Telerik.Reporting.Processing.ParametersManager`1.GetParameters(IDictionary`2 parameterValues)at Telerik.ReportViewer.WebForms.ParametersPage.OnLoadComplete(EventArgs e)at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)the third parameter datasource is an sp with the following parameters inserted -> = FormatArray(Parameters.survFieldsGroup.Value)
Parameters.survFieldsGroup being the second parameter.
It seems the report doesnt know where the userfunction is when it has been migrated to the reportbook.
How can i fix this?
Anders