Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Friday, March 9, 2012

Displaying images from SSAS data source

I'm trying to display the images from the Adventure Works SSAS database in a SSRS report.

I've added an image object to the table, set MIME to image/jpeg (as it is set in the value fiel of the attribute in AW SSAS database) but I'm getting just a 'x' instead of the image and following output:

Preview complete -- 0 errors, 1 warnings

[rsInvalidExpressionDataType] The Value expression used in textbox ‘LargePhoto’ returned a data type that is not valid.

Preview complete -- 0 errors, 1 warnings

[rsInvalidExpressionDataType] The Value expression used in textbox ‘LargePhoto’ returned a data type that is not valid.

Preview complete -- 0 errors, 1 warnings

[rsInvalidExpressionDataType] The Value expression used in image ‘image1’ returned a data type that is not valid.

[rsInvalidDatabaseImage] The Value expression for the image ‘image1’ did not evaluate to an image.

Preview complete -- 0 errors, 2 warnings

But displaying images the same way just using the relational AW DW table DimProduct works well.

(the only difference I've seen is: in the query generator from SSAS there is a cryptic text value displayed as the value of the LargePhoto attribute, if using relational table there is a '<binary>')

relational query:

select productalternatekey, largephoto from dimproduct

SSAS query:

WITH MEMBER measures.test

AS

[Product].[Large Photo].currentmember.membervalue

SELECT NON EMPTY

{ [Measures].[Internet Sales Amount], measures.test } ON COLUMNS,

NON EMPTY { ([Product].[Product].[Product].ALLMEMBERS * [Product].[Large Photo].[Large Photo].ALLMEMBERS) } ON ROWS

FROM [Adventure Works]

Where is the problem ? How can I display images from SSAS in SSRS ?

Any ideas are appreciated.

Jan.

A binary member value comes from SSAS as Base64-encoded. You need to use the following expression in your textbox Value property in SSRS:

=System.Convert.FromBase64String(Fields!test.Value)

|||

Great help Teo!

That's it, thanks a lot !

Jan.

Wednesday, March 7, 2012

Displaying Data of a Cube over Web

When you use BI Dev Studio or SS Management Studio to process an Analysis Services database or object, there's a nice dialog box that shows very robust status and progress information.

Is there any way to capture this information if you are processing something programmatically? Specifically interested in both the ability to capture and display this information to a user when processing via a custom application. Also interested in whether or not there's a way to capture this information to a log (or table) for display and analysis after the fact (or if the custom application is running in a batch mode via a schedule).

Thanks,
Dave FacklerI've been looking for the same thing. Were you able to find where this information is stored/logged?

Thanks!|||One simple way to do this is using the SQL Server Profiler tool which has the option of logging trace information to files or tables as well as the UI. You can also do this programmatically using the AMO using Server.SessionTrace or by adding custom traces to Server.Traces.|||

Using the AMO, you can listen Session Trace. Sample code is following:

this.sessionTrace = server.SessionTrace;

this.sessionTrace.OnEvent += new TraceEventHandler(sessionTrace_TraceEventHandler);

this.sessionTrace.Stopped += new TraceStoppedEventHandler(sessionTrace_Stopped);

if (!this.sessionTrace.IsStarted)

{

this.sessionTrace.Start();

}

|||

You can use AMO (Microsoft.AnalysisServices.dll from "%ProgramFiles%\Microsoft SQL Server\90\SDK\Assemblies") to subscribe to trace events. Sample code below. The code formatting might be lost when posting, but copy paste in VS, and then "Edit -> Advanced -> Format Document" should fix it.

//=====================================================================
//
// File: Program.cs
// Summary: Sample code for using traces with AMO.
// Date: 2006-05-23
//
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
//=====================================================================
using System;
using Microsoft.AnalysisServices;

namespace Microsoft.AnalysisServices.CodeSamples
{
/// <summary>
/// Demonstrates use of traces with AMO.
/// </summary>
/// <remarks>
/// This code requires the "Adventure Works" database to be present on the Analysis Services server
/// and also the "AdventureWorksDW" relational database on SQL Server (for processing objects to
/// generate trace events).
/// </remarks>
class AmoTrace
{
static int Main(string[] args)
{
//--
// There are 2 types of traces that AMO programmer can use:
// - the session trace: provides the events from the current session (established
// on Connect)
// - the custom traces: they allow to choose the particular event classes and
// columns to be traced. Unlike the session trace, a custom trace needs to be
// created and saved to server explicitly (as any other AMO object, like a
// Dimension or a Cube).
//
// This is the plan of the code:
// 1. we'll connect to an Analysis Services server
// 2. we'll locate the "Product" dimension from the "Adventure Works DW" database
// (we'll process it to generate trace events)
// 3. we'll use the session trace
// 4. we'll create, use and then delete a custom trace
//--

string connectionString = "Data Source=localhost";
string databaseName = "Adventure Works DW"; // use "Adventure Works DW Standard Edition" if you have the standard edition installed

try
{
//--
// STEP 1: connect to Analysis Services server.
//--
Server server = new Server();
server.Connect(connectionString);

try
{
//--
// STEP 2: locate the "Product" dimension.
//--
Database database = server.Databases.FindByName(databaseName);
if (database == null)
{
Console.Error.WriteLine("The [{0}] database is missing.", databaseName);
return 1;
}

Dimension productDimension = database.Dimensions.FindByName("Product");
if (productDimension == null)
{
Console.Error.WriteLine("The [Product] dimension is missing.");
return 1;
}

//--
// STEP 3: use the session trace.
//--
UseSessionTrace(server, productDimension);

//--
// STEP 4. create, use and then delete a custom trace.
//--
UseCustomTrace(server, productDimension);

return 0;
}
finally
{
server.Disconnect();
}
}
catch (Exception e)
{
Console.Error.WriteLine(e.ToString());
return 1;
}
}

/// <summary>
/// Demonstrates the use of session trace.
/// </summary>
private static void UseSessionTrace(Server server, Dimension dimensionToProcess)
{
//--
// 1. Subscribe to the session trace events.
//--
SessionTrace sessionTrace = server.SessionTrace;
TraceEventHandler onTraceEvent = new TraceEventHandler(OnTraceEvent);
TraceStoppedEventHandler onTraceStopped = new TraceStoppedEventHandler(OnTraceStopped);

sessionTrace.OnEvent += new TraceEventHandler(OnTraceEvent);
sessionTrace.Stopped += new TraceStoppedEventHandler(OnTraceStopped);
sessionTrace.Start(); // this method is not blocking, it starts a separate thread to listen for events from server


//--
// 2. Process the dimension; this will generate events that we'll display to
// the Console.
//--
try
{
dimensionToProcess.Process(ProcessType.ProcessFull); // this method blocks; while processing, events are received
}
finally
{
//--
// 3. Un-subscribe from the trace.
//--
sessionTrace.Stop();
sessionTrace.OnEvent -= onTraceEvent;
sessionTrace.Stopped -= onTraceStopped;
}
}

/// <summary>
/// Demonstrates the use of a custom trace.
/// </summary>
private static void UseCustomTrace(Server server, Dimension dimensionToProcess)
{
//--
// 1. Create and save to server a custom trace with only the
// ProgressReportBegin, ProgressReportCurrent and ProgressReportEnd events
// and the EventClass and EventSubclass columns.
//--
Trace trace = server.Traces.Add(); // a Name and ID will be generated for the new Trace
TraceEvent event1 = trace.Events.Add(TraceEventClass.ProgressReportBegin);
TraceEvent event2 = trace.Events.Add(TraceEventClass.ProgressReportCurrent);
TraceEvent event3 = trace.Events.Add(TraceEventClass.ProgressReportEnd);

event1.Columns.Add(TraceColumn.EventClass);
event1.Columns.Add(TraceColumn.EventSubclass);

event2.Columns.Add(TraceColumn.EventClass);
event2.Columns.Add(TraceColumn.EventSubclass);

event3.Columns.Add(TraceColumn.EventClass);
event3.Columns.Add(TraceColumn.EventSubclass);

// Save the newly created Trace to the server; others could use it (unlike the session
// trace which is specific to a particular session).
trace.Update();


//--
// 2. Subscribe to the newly create trace.
//--
TraceEventHandler onTraceEvent = new TraceEventHandler(OnTraceEvent);
TraceStoppedEventHandler onTraceStopped = new TraceStoppedEventHandler(OnTraceStopped);

trace.OnEvent += new TraceEventHandler(OnTraceEvent);
trace.Stopped += new TraceStoppedEventHandler(OnTraceStopped);
trace.Start(); // this method is not blocking, it starts a separate thread to listen for events from server

//--
// 3. Process the dimension; this will generate events that we'll display to
// the Console.
//--
try
{
dimensionToProcess.Process(ProcessType.ProcessFull); // this method blocks; while processing, events are received
}
finally
{
//--
// 3. Un-subscribe from the trace.
//--
trace.Stop();
trace.OnEvent -= onTraceEvent;
trace.Stopped -= onTraceStopped;
}


//--
// 4. Cleanup: delete the trace from the server. We could leave it (to be used
// in the future or by other users), but we'll delete it since it was only a
// sample.
//--
trace.Drop();
}

/// <summary>
/// Event handler for trace events, called on a separate thread by the AMO trace.
/// </summary>
/// <remarks>
/// When the Start() method is called on a Trace, AMO creates a separate thread
/// that listens for events from the server; when an event is read, this method is
/// called on that thread. There should be no heavy calculations in this method
/// because the trace thread will be blocked and events might overflow the connection's
/// buffer(s), resulting in loss of events.
/// </remarks>
private static void OnTraceEvent(object sender, TraceEventArgs e)
{
Console.WriteLine("Event ({0}, {1})", e.EventClass, e.EventSubclass);
}

/// <summary>
/// Event handler for trace stop events, called on a separate thread by the AMO trace when
/// a trace is stopped (by the user, by the server or by an exception).
/// </summary>
/// <remarks>
/// There are 3 main reasons for a trace to be stopped:
/// - the user called the Stop() method
/// - the server ended the trace (because somebody deleted it meanwhile for example)
/// - an exception occured during parsing of events (because of a network disconnect for example)
/// </remarks>
private static void OnTraceStopped( ITrace sender, TraceStoppedEventArgs e )
{
Console.WriteLine("Trace Stopped: Cause = {0}, Exception = {1}", e.StopCause, e.Exception);
}
}
}

Adrian Dumitrascu.

|||Does anyone know if there is anyway of figuring out which events support which columns from the object model? At the moment I have had to resort to hard coding the columns supported by a given event.|||Thanks for all the responses and the sample code!

I would like to capture this information using SSIS. Of course, the script tasks only supports VB as well. Is there an easy way to capture trace information from the cube processing within SSIS?

Thanks again for all the help!|||

AMO doesn't provide the list of supported columns for a particular trace event. But, there are 2 other places containing the associations:

- the "tracedefinition90.xml" file (search for it in "%ProgramFiles%\Microsoft SQL Server"). You will need to parse it to generate a user-friendlier map. But please note that this file might change in the future (probably not the xml schema, but columns/events might be added/removed/changed).

- SQL Profiler; when you create a new AS2005 trace, in the 'Trace Properties' window, see the 'Events Selection' tab (generated from the trace definition file)

Adrian Dumitrascu

|||

I don't have yet a sample VB.NET code for using AMO traces, but a work-around is to have a separate assembly containing the trace code (written in C# from the sample posted previously) and use this assembly from the VB.NET script task in SSIS.

Adrian Dumitrascu

|||

You could try running the sample code through one of the online C# to VB.NET converters (eg. http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx). They are not perfect, but they can get you pretty close.

I don't know if the event handling code will work inside an SSIS script task. In this case one option might be to configure the trace to log to a file.

|||

Thanks Adrian, the tracedefinitions90.xml looks like it could be very useful.

The other thing I just found was that by going File -> Export -> Script Trace Definition. I can get an xmla script that will create the server side trace.

This might suit my needs as I can configure the trace using the profiler GUI, script it out and then just get my app to execute the xmla and then connect to the server side trace.

|||

Hi,

I have created an analysis services project using SQL Server 2005, in which I have included a cube, dimension, data source and data view. Now using the Analysis services Browser tab of cube I can see the Pivot table exactly the way I want where I can drag & drop table fields as per my requirements. But I am struggling to display the same cube over the Web. Can any please tell me that how I can publish the contents of Cube i.e. Pivot table on a web application so that end user can use this. I want the same functionality, which I can see in the Browser tab of Cube in AS2005 i.e. user should have freedom to drag & drop the fields exactly like in Excel Pivot table.

Any help would be highly appreciated.

Thanks in advance.

|||

Take a look at the following link on Mosha's website. It contains a set of links to web-based browsers and applications. You can probably use them as a guide to developing your own custom web-based app for doing this (or perhaps use one of the listed applications directly).

http://www.mosha.com/msolap/util.htm#ThinClients

HTH,

Dave Fackler

Sunday, February 19, 2012

Display of SqlDataSource

I'm trying to follow along with lesson07 Web Development Express series and when I drag the SqlDataSource tool onto my form I do not see the object on the screen. I therefore can not configure it until I have placed GridView object onto my form.

I hope you can help me in how to view the SqlDataSource or inform me where I can get further informationThere is a menu option to show/hide the controls which have no display. Sorry, can't think of it off hand, but it's there.|||

Thanks;

I found it under View-Non_Visual Controls

Bruce

Friday, February 17, 2012

display object on every page and List question

Hi there,

a little new to Reporting Services 2005, but can somebody show me how to display an object on every page? I have a sub report that I use and I wish for it to display on every page.

As well, is it possible to keep items in a List object together? For example, my List dynamically grows, but I wish to keep the items in the list together on the same page. Right now, the items split onto different pages.

Any help or comments is greatly appreciated. Thanks in advace!To display the sub-report on every page, just create a table, place the sub-report in the table header, then mark the table header repeated on each page. For the second question, try setting the KeepTogether property on the List.

display images from AutoCAD or Visio

How can we display images from AutoCAD or Visio (or any other OLE Server
object stored in an image-type field in SQL Server) in a Report Services
report?
-propheadPlease check this related posting:
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=850bd765-5c85-41c2-a9ed-3ba003a4b7f6&sloc=en-us
Note: only certain image formats (mime types) can be used in Reporting
Services.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"prophead" <prophead@.discussions.microsoft.com> wrote in message
news:5DE2D6B6-4D2A-4049-8C0C-B2DFCFB322B6@.microsoft.com...
> How can we display images from AutoCAD or Visio (or any other OLE Server
> object stored in an image-type field in SQL Server) in a Report Services
> report?
> -prophead

Tuesday, February 14, 2012

Display group data on every page

Hi!
I have two groupings placed in on list object and I'm trying to
grouping data to be displayed on every page but without luck. The
grouping data is displayed correctly at the beginning of the group but
since it might be a long list of items in one group I would like to
display the group header on every page. Is this possible? I've
searched the net and found answers that it should be possible to do
this but I can't figure out how. HELP Please.
Cheers ErikOn Feb 14, 10:16 pm, e...@.liffner.se wrote:
> Hi!
> I have two groupings placed in on list object and I'm trying to
> grouping data to be displayed on every page but without luck. The
> grouping data is displayed correctly at the beginning of the group but
> since it might be a long list of items in one group I would like to
> display the group header on every page. Is this possible? I've
> searched the net and found answers that it should be possible to do
> this but I can't figure out how. HELP Please.
> Cheers Erik
When editing group in designer, there should be checkboxes called
'Repeat Group Header', Repeat Group Footer'. These will cause the
group header/footer to be repeated on every page.|||On 15 Feb, 01:56, "Rowen" <rowen...@.gmail.com> wrote:
> On Feb 14, 10:16 pm, e...@.liffner.se wrote:
> > Hi!
> > I have two groupings placed in on list object and I'm trying to
> > grouping data to be displayed on every page but without luck. The
> > grouping data is displayed correctly at the beginning of the group but
> > since it might be a long list of items in one group I would like to
> > display the group header on every page. Is this possible? I've
> > searched the net and found answers that it should be possible to do
> > this but I can't figure out how. HELP Please.
> > Cheers Erik
> When editing group in designer, there should be checkboxes called
> 'Repeat Group Header', Repeat Group Footer'. These will cause the
> group header/footer to be repeated on every page.
Hi!
Is this true even if I use a list as the grouping object. I'm unable
to find the checkboxes in my rdl file.|||On Feb 16, 2:04 am, e...@.liffner.se wrote:
> On 15 Feb, 01:56, "Rowen" <rowen...@.gmail.com> wrote:
> > On Feb 14, 10:16 pm, e...@.liffner.se wrote:
> > > Hi!
> > > I have two groupings placed in on list object and I'm trying to
> > > grouping data to be displayed on every page but without luck. The
> > > grouping data is displayed correctly at the beginning of the group but
> > > since it might be a long list of items in one group I would like to
> > > display the group header on every page. Is this possible? I've
> > > searched the net and found answers that it should be possible to do
> > > this but I can't figure out how. HELP Please.
> > > Cheers Erik
> > When editing group in designer, there should be checkboxes called
> > 'Repeat Group Header', Repeat Group Footer'. These will cause the
> > group header/footer to be repeated on every page.
> Hi!
> Is this true even if I use a list as the grouping object. I'm unable
> to find the checkboxes in my rdl file.
The checkbox is visible when editing a report in design mode (i.e. in
Visual Studio). There will not be any checkbox in the rdl file.
If you want to add the property to the rdl file via a text editor, it
should be like this:
<TableGroup>
<Header>
<TableRows>...
</TableRows>
<RepeatOnNewPage>true</RepeatOnNewPage>
</Header>
<Grouping Name="...">
<GroupExpressions>
...
</GroupExpressions>
</Grouping>
<Sorting>
...
</Sorting>
</TableGroup>