Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > ReportGraph control in Repeater transformation View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 8/22/2013 2:29:34 AM
   
ReportGraph control in Repeater transformation
I'm attempting to display several dynamic reports in a repeaters transformation and think I'm missing one simple step. I can get the repeaters transformation to render with the control but the < map > object doesn't ever get rendered. The transformation is simple and I'm guessing I will need to set properties in a < script > tag but not sure which property would need to be set. Any suggestions?
<%@ Register Src="~/CMSModules/Reporting/Controls/ReportGraph.ascx" TagName="ReportGraph" TagPrefix="cms" %>

<div class="row">
<h2><a href="<%# URLHelper.ResolveUrl(URLHelper.CurrentURL + "/" + EvalText("School").Replace(" ", "-")) %>"><%# Eval("School") %></a></h2>
<cms:ReportGraph ID="rpt1" runat="server" Width="250" Height="250" IsLiveSite="true" Parameter="SchoolOverview.SchoolOverview" ReportItemName="SchoolOverview;SchoolOverview" />
</div>

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 8/23/2013 11:16:50 AM
   
RE:ReportGraph control in Repeater transformation
I was able to resolve this. I needed to set the parameters somewhat manually. See the full transformation code:
<%@ Register Src="~/CMSModules/Reporting/Controls/ReportGraph.ascx" TagName="ReportGraph" TagPrefix="cms" %>
<script runat="server">

/// Manually set the report xml parameters and definition
protected void Page_Init(object sender, EventArgs e)
{
string reportXmlData = "<NewDataSet> <Table1> <SchoolYear>" + EvalText("SchoolYear") + "</SchoolYear> <SchoolType>" + CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%SchoolType%}") + "</SchoolType> <School>" + EvalText("School") + "</School> </Table1></NewDataSet>";
System.Text.StringBuilder reportXmlDefinition = new System.Text.StringBuilder();
reportXmlDefinition.Append("<?xml version=\"1.0\" encoding=\"utf-16\"?>");
reportXmlDefinition.Append(" <xs:schema id=\"NewDataSet\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">");
reportXmlDefinition.Append(" <xs:element name=\"NewDataSet\" msdata:IsDataSet=\"true\" msdata:UseCurrentLocale=\"true\">");
reportXmlDefinition.Append(" <xs:complexType>");
reportXmlDefinition.Append(" <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">");
reportXmlDefinition.Append(" <xs:element name=\"Table1\">");
reportXmlDefinition.Append(" <xs:complexType>");
reportXmlDefinition.Append(" <xs:sequence>");
reportXmlDefinition.Append(" <xs:element name=\"SchoolYear\" type=\"xs:string\" minOccurs=\"0\" />");
reportXmlDefinition.Append(" <xs:element name=\"SchoolType\" type=\"xs:string\" minOccurs=\"0\" />");
reportXmlDefinition.Append(" <xs:element name=\"School\" type=\"xs:string\" minOccurs=\"0\" />");
reportXmlDefinition.Append(" </xs:sequence>");
reportXmlDefinition.Append(" </xs:complexType>");
reportXmlDefinition.Append(" </xs:element>");
reportXmlDefinition.Append(" </xs:choice>");
reportXmlDefinition.Append(" </xs:complexType>");
reportXmlDefinition.Append(" </xs:element>");
reportXmlDefinition.Append(" </xs:schema>");
rpt1.LoadDefaultParameters(reportXmlData, reportXmlDefinition.ToString());
}

protected void Page_Load(object sender, EventArgs e)
{
rpt1.ReloadData(true);
}
</script>
<%# ((DataItemIndex % 2 == 0) ? "<div class=\"row\">" : "" ) %>
<div class="<%# ((DataItemIndex % 2 == 0) ? "first " : (DataItemIndex % 2 == 1 ? "last " : "")) %>six columns">
<cms:ReportGraph ID="rpt1" runat="server" Width="375" Height="375" Parameter="Overview.MyOverview" ReportItemName="Overview;MyOverview" ItemType="Graph" />
</div>
<%# (DataItemIndex % 2 == 1 || DataItemIndex == DataRowView.DataView.Count - 1 ? "</div>" : "") %>