Private Sub LoadChart(ByVal sFileName As String, ByRef sChart As Telerik.Reporting.Chart) Dim inFile As StreamReader = File.OpenText(sFileName) Try Dim j As Integer Dim sLine As String Dim sValues() As String Dim chartSeries() As Telerik.Reporting.Charting.ChartSeries Dim bFirstLoad As Boolean = False Dim yMax, yMin As Double Do While inFile.Peek <> -1 sLine = inFile.ReadLine sValues = Split(sLine, vbTab) If UCase(Trim(sValues(0))) = "TEMPERATURE" Then 'Create an array of Series for length of value 'Create Chart Series Names For j = 0 To sValues.Length - 1 ReDim Preserve chartSeries(j) chartSeries(j) = New Telerik.Reporting.Charting.ChartSeries If j > 0 Then If sValues(j) <> "" Then chartSeries(j).Name = sValues(j) chartSeries(j).Type = Charting.ChartSeriesType.Line chartSeries(j).Appearance.PointMark.Dimensions.Width = 1 chartSeries(j).Appearance.PointMark.Dimensions.Height = 1 chartSeries(j).Appearance.PointMark.FillStyle.MainColor = chartSeries(j).Appearance.LineSeriesAppearance.Color chartSeries(j).Appearance.PointMark.Visible = True chartSeries(j).DefaultLabelValue = "" chartSeries(j).YAxisType = Charting.ChartYAxisType.Primary End If End If Next ElseIf IsNumeric(sValues(0)) Then For j = 0 To sValues.Length - 1 If sValues(j) <> "" Then If j > 0 Then If bFirstLoad = False Then If yMax = 0 Then yMax = CDbl(sValues(j)) End If If yMin = 0 Then yMin = CDbl(sValues(j)) End If bFirstLoad = True End If 'Add the values to the chart series chartSeries(j).AddItem(CDbl(sValues(j))) chartSeries(j).Item(chartSeries(j).Items.Count - 1).XValue = CDbl(sValues(0)) chartSeries(j).Item(chartSeries(j).Items.Count - 1).YValue = CDbl(sValues(j)) chartSeries(j).Item(chartSeries(j).Items.Count - 1).ActiveRegion.Tooltip = CDbl(sValues(j)) 'Update Min and Max Values If yMin > CDbl(sValues(j)) Then yMin = CDbl(sValues(j)) End If If yMax < CDbl(sValues(j)) Then yMax = CDbl(sValues(j)) End If End If End If Next End If Loop For j = 0 To chartSeries.Length - 1 If j > 0 Then sChart.Series.Add(chartSeries(j)) End If Next sChart.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Temperature" sChart.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = Color.Black sChart.PlotArea.XAxis.Appearance.Visible = Charting.Styles.ChartAxisVisibility.True sChart.PlotArea.XAxis.VisibleValues = Charting.Styles.ChartAxisVisibleValues.All sChart.PlotArea.XAxis.Appearance.Width = 3 sChart.PlotArea.XAxis.MinValue = 10 sChart.PlotArea.XAxis.MaxValue = 100 sChart.PlotArea.XAxis.LabelStep = 10 sChart.PlotArea.XAxis.MaxItemsCount = 100 + 1 sChart.PlotArea.XAxis.AutoScale = False sChart.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Concentration" sChart.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = Color.Black sChart.PlotArea.YAxis.Appearance.Visible = Charting.Styles.ChartAxisVisibility.True sChart.PlotArea.YAxis.Appearance.Width = 3 sChart.PlotArea.YAxis.IsZeroBased = False sChart.PlotArea.YAxis.VisibleValues = Charting.Styles.ChartAxisVisibleValues.All sChart.PlotArea.YAxis.MaxValue = yMax sChart.PlotArea.YAxis.MinValue = yMin sChart.PlotArea.YAxis.AutoScale = False sChart.ChartTitle.TextBlock.Text = "Concentration vs Temperature" Catch ex As Exception VOMsgBox(ex.ToString) Finally inFile.Close() inFile = Nothing End Try End SubHello Telerik Team,
I am getting the error."An error has occured while processing textbox:The expression contains undefined
function call FormType()".
I have a report..where in i used a user function called "FormType".
My datasource for teh report is sharepoint list.
I am passing a parameter to the user function in the code.My user functions retrieves three values(one each time based on the conditions)But when i select the user function..in the edit expression dialog box..
i am not writing any parameter inside the user function as i am not sure what to write there.
I have gone through http://www.telerik.com/support/kb/reporting/designing-reports/the-expression-contains-undefined-function-call-myuserfunction-error.aspx
and thought i might fall in 2nd cateogry..but unable to find a solution for that
Please help me.
Here is the code.
InitializeComponent();
string strType;
SPSite oSite = new SPSite("spsiteurl");
SPWeb oWeb = oSite.OpenWeb();
string[] parameters = { "10", "100", "1000" };
Telerik.Reporting.ReportParameter param1 = new Telerik.Reporting.ReportParameter();
param1.Name = "ItemID";
param1.Type = Telerik.Reporting.ReportParameterType.Integer;
param1.AllowBlank = false;
param1.AllowNull = true;
param1.Text = "ItemID";
param1.Visible = true;
this.ReportParameters.Add(param1);
SPQuery qry = new SPQuery();
SPList oList = oWeb.Lists["customlist"];
string camlQuery = CreateCAMLQuery(parameters);
qry.Query = camlQuery;
SPListItemCollection listItemsCollection = oList.GetItems(qry);
StringBuilder sb1 = new StringBuilder();
for (int i = 0; i < parameters.Length; i++)
{
foreach (SPListItem item in listItemsCollection)
{
if (parameters[i] != "")
{
sb1 = new StringBuilder();
if (parameters[i] == item["ItemID"].ToString())
{
sb1.Append(parameters[i].ToString() + "-" + item["FormType"].ToString() + ",");
strType = FormType(sb1.ToString());
break;
}
}
}
}
DataTable listItemsTable = oList.GetItems(qry).GetDataTable();
this.DataSource = listItemsTable;
}
private static string CreateCAMLQuery(string[] parameters)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < parameters.Length; i++)
{
if (i >= 2 && !sb.ToString().EndsWith(@"</Or>"))
{
sb.Insert(0, "<Or>");
sb.Insert(sb.Length, "</Or>");
}
sb.Append("<Eq>");
sb.Append("<FieldRef Name='ItemID'/>");
sb.AppendFormat("<Value Type='Choice'>" + parameters[i] + "</Value>", i);
sb.Append("</Eq>");
if (i >= 2 && !sb.ToString().EndsWith(@"</Or>"))
{
sb.Insert(0, "<Or>");
sb.Insert(sb.Length, "</Or>");
}
}
sb.Insert(0, "<Where>");
sb.Append("</Where>");
return sb.ToString();
}
public static string FormType(string strFormType)
{
string[] FormTypeValues = strFormType.Split(",".ToCharArray());
string[] values = FormTypeValues[0].Split("-".ToCharArray());
string ItemId = values[0];
string formT = values[1];
switch (formT)
{
case "PM":
formT = "Parking";
strFormType = formT;
break;
case "PCO":
formT = "Nonparking";
strFormType = formT;
break;
}
return strFormType;
}
I appreciate your support
Thank you,
Smith