all groups > sql server reporting services > december 2005 >
You're in the

sql server reporting services

group:

Page Break in Group Dynamically?


Page Break in Group Dynamically? brianpmccullough
12/13/2005 3:16:07 PM
sql server reporting services:
Hello,

I am trying to dynamically create a Page Break in a Group using a parameter
(Parameters!GroupBreak1).

I tried entering the following text into the <PageBreakAtEnd> element in my
<Grouping> element:

=CBool(iif(Parameters!GroupBreak1.Value = "true", true, false))

I also tried without the CBool(), but that didn't work either...EVERYTHING
in RDL is Expression based, please tell me that this is too!

Can anyone confirm that this element does not accept expressions?

If it doesn't does anyone have any ideas for dynamically breaking on a group?

Thanks!

Re: Page Break in Group Dynamically? brianpmccullough
12/14/2005 7:27:02 PM
Thanks Teo...I kinda gathered that after carefully reading the documentation
on the PageBreakAtEnd element.

Out of curiousity, have you seen or heard of a Reporting Services solution
in which "template" rdl files are created and then sorting, grouping
(including counts/sums/page breaks), filtering are all configurable by users?


This is what I am working on and after finding out that parameters would not
work for me (b/c of the PageBreakAtEnd element), my approach is going to be
to load the RDL definition of the template and then allow the users to
configure the report based on the Fields of the "Primary" dataset.
Configuration data is stored in a set of SQL tables and is used to manipulate
the template RDL (using the XML DOM).

Have you seen similar solutions or can you recommend a "cleaner" way of
doing this?

I appreciate your help!

-Brian

[quoted text, click to view]
Re: Page Break in Group Dynamically? Teo Lachev [MVP]
12/14/2005 9:46:02 PM
As it stands, RS doesn't support conditional page breaks. I am pushing hard
to get this feature implemented in the next release since I am aware that is
much wanted.

--
HTH,
----------------------------------------------
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/

-------------------------------------------------
[quoted text, click to view]

Re: Page Break in Group Dynamically? brianpmccullough
12/15/2005 6:22:04 PM
Teo,

Thanks again for the help!!!

I did try creating an object model on top of the RDL objects, basically I
was sending in an xmlnode to each object and then the properties were going
to going to reference the node InnerText and attribute values.

For example:

Public Class SortBy
Public Sub New(ByVal node As XmlNode)
End Sub

Public Property SortExpression As String
Get
Return me._node.SelectSingleNode("SortExpression").InnerText
End Get
Set (ByVal value As String)
me._node.SelectSingleNode("SortExpression").InnerText = value
End Set

End Class

I got discouraged when I realized I was going to have to pass around a
namespace manager reference to everything when I needed to XPath query some
of the nodes that I didn't need a complete object model for...

This was the only way I saw to do it so that I wouldn't have to reserialize
things back into RDL (xml).

Since my RDL manipulation was limited to setting the visible properties on
existing group headers and footers, clearing and inserting sortby elements,
setting the commandtext for a dataset and a few minor formatting items, i
just ended up creating a really simple RdlReport object that exposed some
methods to take care of this...

How did you handle the serialization of your RDL object model?

Thanks

-Brian

[quoted text, click to view]
Re: Page Break in Group Dynamically? Teo Lachev [MVP]
12/15/2005 8:54:18 PM
[quoted text, click to view]

Sounds familiar :-) We are creating an ad hoc designer right now in hope
that the RS team will provide an reusable WYSWYG designer in RS 2007(?).
Based on my experience, if you need to do a lot of RDL manipulation, what I
would recommend is you build an object model on top of it. Creating objects
for all RDL elements is tedious and will take some time but it really pays
off in a long run because you don't have to use the XML DOM API. It worked
great for us.

--
HTH,
----------------------------------------------
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/

-------------------------------------------------
[quoted text, click to view]

Re: Page Break in Group Dynamically? Teo Lachev [MVP]
12/16/2005 8:01:07 AM
Our approach is to implement one class for each RDL object which "knows" how
to serialize and deserialize itself. Then, when you serialize the master
report object, the whole hierarchy is serialized. I believe this is pretty
much what the internal RDL object in the Report Designer does as well. This
is what the implementation for the Field object may look like:
using System;

using System.Xml;

using System.Xml.Serialization;

namespace Reporting.ObjectModel

{

/// <summary>

/// Contains information about a field within the data model of the report.

/// </summary>

public class Field : IXmlSerializable

{

#region Constants

internal enum StandardFieldNames

{

Item,

Entity

}

#endregion

#region Private Variables

private string _name;

private string _dataField;

private Value _value;

private Type _typeName;

#endregion

/// <summary>

/// Creates an instance of a Field.

/// </summary>

public Field(){}

/// <summary>

/// Creates an instance of a Field and sets its state.

/// </summary>

public Field(string name, string dataField, Type type)

{

_name = name;

_dataField = dataField;

_typeName = type;

}

#region Public Properties

/// <summary>

/// Name to use for the field within the report.

/// </summary>

public string Name

{

get {return _name;}

set {_name = value;}

}

/// <summary>

/// Name of the field in the query.

/// </summary>

public string DataField

{

get {return _dataField;}

set {_dataField = value;}

}

/// <summary>

/// An expression that evaluates to the value of this field.

/// </summary>

public Value Value

{

get

{

if (_value == null)

_value = new Value();

return _value;

}

set {_value = value;}

}

/// <summary>

/// An expression that evaluates to the value of this field.

/// </summary>

public Type TypeName

{

get

{

return _typeName;

}

set { this._typeName = value; }

}

#endregion

#region IXmlSerializable Members

/// <summary>

/// Converts a Field into its RDL representation .

/// </summary>

/// <param name="writer">The <typeparamref name="XmlWriter"/> stream to
which the Field is serialized.</param>

public void WriteXml(XmlWriter writer)

{

//--- Field

writer.WriteStartElement(Rdl.FIELD);

writer.WriteAttributeString(Rdl.NAME, _name);

//--- DataField

if (_dataField != null)

writer.WriteElementString(Rdl.DATAFIELD, _dataField);

//--- TypeName


if (_typeName != null)

writer.WriteElementString("rd:TypeName", _typeName.ToString());

//--- Value

if (_value != null)

((IXmlSerializable)_value).WriteXml(writer);

writer.WriteEndElement();

}

/// <summary>

///

/// </summary>

/// <returns></returns>

public System.Xml.Schema.XmlSchema GetSchema()

{

return null;

}

/// <summary>

/// Generates an Field from its RDL representation.

/// </summary>

/// <param name="reader">The <typeparamref name="XmlReader"/> stream from
which the Field is deserialized</param>

public void ReadXml(XmlReader reader)

{

if (reader.AttributeCount > 0)

_name = reader[Rdl.NAME];

while (reader.Read())

{

if (reader.NodeType == XmlNodeType.EndElement && reader.Name == Rdl.FIELD)

{

break;

}

else if (reader.NodeType == XmlNodeType.Element)

{

//--- DataField

if (reader.Name == Rdl.DATAFIELD)

_dataField = reader.ReadString();

//--- Value

if (reader.Name == Rdl.VALUE)

{

if (_value == null)

_value = new Value();

((IXmlSerializable)_value).ReadXml(reader);

}

}

}

}

#endregion

}

}


--
HTH,
----------------------------------------------
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/

-------------------------------------------------
[quoted text, click to view]
AddThis Social Bookmark Button