Host a SQL Reporting Services Report Options
boggyboy
Posted: Friday, July 04, 2008 6:18:03 PM
Rank: Newbie

Joined: 7/3/2008
Posts: 21
Location: Florida, USA
Extreme newbie with Umbraco so pardon the stupid question...I would like to render a SQL Reporting Services 05 report within a content page.

My Reporting services reports render as aspx pages such as

http://localhost:8080/Reports/Pages/Report.aspx?ItemPath=%2fAdventureWorks+Sample+Reports%2fTerritory+Sales+Drilldown

Guidance in setting this up much appreciated!!
drobar
Posted: Friday, July 04, 2008 7:16:31 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,410
Location: KY, USA
Hi, boggyboy, and welcome to umbraco!

Seems like you could handle this a few ways...

1. Just link to the report from your umbraco page
2. Show it in an iFrame
3. Do some Ajax to grab the content and shove it into a div tag (basically, the 'web 2.0' way of doing #2)
4. Write an xslt macro to get the content and shove it into a div tag

I'd go for #4, myself.

The important bits of doing this are:
- Add a textfield property to the docType. Let's call the alias 'reportUrl' for convenience. This will hold the URL to the report.

- On a content page using that docType, enter a URL (the url only needs to be accessible from your umbraco server, not the end user, so it can be protected behind a firewall or DMZ if you like)

- Create a new xslt file and associated macro. Choose the 'clean' xslt template.

- In the xslt, you'll basically just have the following (typed in the forum, might not be 100% perfect, but it'll be close):
Code:

<xsl:template match="/">
    <xsl:value-of select="umbraco.library:GetXmlDocumentByUrl($currentPage/data [@alias='reportUrl'])" disable-output-escaping="yes"/>
</xsl:template>


- In the template associated with your docType, insert the macro you just created.

That's the general idea. Let us know how you make out!

cheers,
doug.


MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
boggyboy
Posted: Friday, July 04, 2008 7:58:58 PM
Rank: Newbie

Joined: 7/3/2008
Posts: 21
Location: Florida, USA
Wow... Thanks for all the help! I'll give it a shot.
boggyboy
Posted: Saturday, July 05, 2008 8:49:10 PM
Rank: Newbie

Joined: 7/3/2008
Posts: 21
Location: Florida, USA
Well... Unfortunately I get an error when I try to save the XSLT file.

heres the xslt:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>

<xsl:template match="/">

<xsl:value-of select="umbraco.library:GetXmlDocumentByUrl($currentPage/data [@alias='reportUrl'])" disable-output-escaping="yes"/>

</xsl:template>

</xsl:stylesheet>

and the error:
Error occured
System.Xml.XPath.XPathException: Function 'umbraco.library:GetXmlDocumentByUrl()' has failed. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UriFormatException: Invalid URI: The URI is empty.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Net.WebRequest.Create(String requestUriString)
at umbraco.library.GetXmlDocumentByUrl(String Url)

I'm struggling with understanding the interplay of macros, templates, doc types i guess.
drobar
Posted: Saturday, July 05, 2008 10:02:53 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,410
Location: KY, USA
I've got to run, but the short answer is... put a tick in the 'skip testing' box when you save the xslt file and it should work. There are a number of posts that explain why this can happen and what to do about it. For the moment... just skip the testing and save the xslt. It should run properly when used in it proper place.

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
boggyboy
Posted: Sunday, July 06, 2008 1:17:22 AM
Rank: Newbie

Joined: 7/3/2008
Posts: 21
Location: Florida, USA
Thanks Doug, tired it that way, however I get the following error on the published page "Error parsing XSLT file: \xslt\Test2.xslt "
Dirk
Posted: Sunday, July 06, 2008 10:28:50 AM

Rank: Fanatic

Joined: 9/27/2007
Posts: 463
Location: Belgium
Hi boggyboy,

Start by surrounding the

Code:
<xsl:value-of select="umbraco.library:GetXmlDocumentByUrl($currentPage/data [@alias='reportUrl'])" disable-output-escaping="yes"/>


by a <xsl:if> to check for empty data, it will at least stop the error.

If not sure what output you get, dump the value of

$currentPage/data [@alias='reportUrl'] in a <xsl:value-of>

first to see if there's data available. At least you know that that part is (not) working?

Hope that helps,
/Dirk


level 1 certified - umbraco blog at netaddicts.be
boggyboy
Posted: Sunday, July 06, 2008 2:29:01 PM
Rank: Newbie

Joined: 7/3/2008
Posts: 21
Location: Florida, USA
Thanks Dirk. I'll see if I can figure that out. Not sure the syntax being new to XSLT.
boggyboy
Posted: Sunday, July 06, 2008 3:38:21 PM
Rank: Newbie

Joined: 7/3/2008
Posts: 21
Location: Florida, USA
Thanks again. I Tried it...

If I comment out the the following: <xsl:value-of select="umbraco.library:GetXmlDocumentByUrl($currentPage/data [@alias='reportUrl'])" disable-output-escaping="yes"/>

and add <xsl:value-of select="$currentPage/data [@alias='reportUrl']/text()"/>

the XSLT parses and the published page displays the 'reportUrl' for my content page as desired.
If I uncomment the first statement it wont parse. If I save the xslt without error checking , the published page shows a error as follows:

System.Xml.XmlException: An error occurred while parsing EntityName. Line 3, position 101. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseEntityName() at System.Xml.XmlTextReaderImpl.ParseEntityReference() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at umbraco.library.GetXmlDocumentByUrl(String Url)

This is a different error that earlier. By the way, the reportUrl is of type Textstring in my document type.

Sorry to be such a pain. I very much like what I see with Umbraco but finding it hard to learn
drobar
Posted: Monday, July 07, 2008 3:25:43 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,410
Location: KY, USA
Does your 'reportUrl' include the "http://" portion of the url? GetXmlDocumentByUrl needs a full url, such as "http://www.example.com/mypage.aspx"

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.