Showing posts with label instead. Show all posts
Showing posts with label instead. Show all posts

Tuesday, March 27, 2012

Calling SqlDataSource from DLL instead of CodeFile C#.

Hello,

Is it possible to call a SqlDataSource from a DLL within a method like you can from the CodeFile? I'm getting this error: The Name SqlDataSource1 does not exist in the current context when trying to call it from within a method defined in a DLL. Thanks!

It would be much much better if you can post your code here.

The Name SqlDataSource1 does not exist in the current context

Most probably you didn't declare this parameter before you refer to it.

Is it possible to call a SqlDataSource from a DLL within a method like you can from the CodeFile?

Well, i think it totally depends on whethere you have passed that sqldatasource value to your dll.If yes, you can call that sqldatasource within your dll.

BTW, remember to add necessary dlls and using proper namespaces in your dll, thus sqldatasource class may not be identified.

Hope my suggestion helps

Saturday, February 25, 2012

Calendar parameter in OLAP report

Hi,

I am trying to find the best way to use a date parameter on a OLAP report and get the calendar pop to be used instead of a dropdown.

Whenever I change from string to datetime for the parameter I (of course) get an error about different data types, since OLAP is returning the fields as strings and formatted.

Any easy (or best) approach to use to get a calendar pop to work with an OLAP report? I am mainly doing this for date range searches and do not want people to pick from huge dropdowns for dates.

Thanks.

I have made a few posts explaining how to use a calendar control with MDX, here is a link to probably the most helpful (as it has examples): http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1506211&SiteID=1

Basically, you need to take the output of the calendar control, CDate() it, then use Format() to generate a string that is compatable with how you have set up your heirarchy members.

Friday, February 24, 2012

Calculations in a subcube world

I'm having trouble getting my calculations to work with query tools that use subcubes in the WHERE clause instead of a normal slicer. Both Excel 2007 and SSRS (when using the query designer) use this technique.

This is an example of a calculation:

CREATE MEMBER CURRENTCUBE.[MEASURES].[YTD]

AS SUM(

PERIODSTODATE([Time].[Y-Q-M-D].[Year],

[Time].[Y-Q-M-D].CurrentMember),

[Measures].CurrentMember),

FORMAT_STRING = "#,#",

VISIBLE = 1;

A typical query through Excel 12 will use the following MDX to filter when selecting March 2006 from a time hierarchy:

..FROM (SELECT ({[Time].[Y-Q-M-D].[Quarter].&[2006]&[1]}) ON COLUMNS FROM [Datawarehouse])

Instead of the old-fashioned

WHERE([Time].[Y-Q-M-D].[Quarter].&[2006]&[1])

When querying for March 2006 filtered by a subcube the mentioned calculated member will return NULL, when hand crafting the query using the WHERE construct, it will return the expected results.

Running a select through Excel 2007 with the filter and the following test member makes the problem obvious:

CREATE MEMBER CURRENTCUBE.[MEASURES].[test]

AS [Time].[Y-Q-M-D].CurrentMember.Name,

VISIBLE = 1;

The .CurentMember of the Y-Q-M-D hierarchy is the All member when a subcube is used, not the actual member(s) in the filter.

Can anyone advice me on how to formulate my calculations so they work with subcubes?

Hi Peter

This is a known issue. Please see the following blog entry for an elaboration.

http://www.sqljunkies.com/WebLog/reckless/archive/2006/03/08/18601.aspx

Calculations in a subcube world

I'm having trouble getting my calculations to work with query tools that use subcubes in the WHERE clause instead of a normal slicer. Both Excel 2007 and SSRS (when using the query designer) use this technique.

This is an example of a calculation:

CREATE MEMBER CURRENTCUBE.[MEASURES].[YTD]

AS SUM(

PERIODSTODATE([Time].[Y-Q-M-D].[Year],

[Time].[Y-Q-M-D].CurrentMember),

[Measures].CurrentMember),

FORMAT_STRING = "#,#",

VISIBLE = 1;

A typical query through Excel 12 will use the following MDX to filter when selecting March 2006 from a time hierarchy:

..FROM (SELECT ({[Time].[Y-Q-M-D].[Quarter].&[2006]&[1]}) ON COLUMNS FROM [Datawarehouse])

Instead of the old-fashioned

WHERE([Time].[Y-Q-M-D].[Quarter].&[2006]&[1])

When querying for March 2006 filtered by a subcube the mentioned calculated member will return NULL, when hand crafting the query using the WHERE construct, it will return the expected results.

Running a select through Excel 2007 with the filter and the following test member makes the problem obvious:

CREATE MEMBER CURRENTCUBE.[MEASURES].[test]

AS [Time].[Y-Q-M-D].CurrentMember.Name,

VISIBLE = 1;

The .CurentMember of the Y-Q-M-D hierarchy is the All member when a subcube is used, not the actual member(s) in the filter.

Can anyone advice me on how to formulate my calculations so they work with subcubes?

Hi Peter

This is a known issue. Please see the following blog entry for an elaboration.

http://www.sqljunkies.com/WebLog/reckless/archive/2006/03/08/18601.aspx

Tuesday, February 14, 2012

Calculating on Reporting Services

I don't know if it is possible to do a calculation for reporting services in the application instead of on the stored procedure.

Because I feel that it is would be easier to calculate inside the application by passing some fields instead of do multiple join and check inside the stored procedure.

Any comment would be greatly appreciate.

You can use a vbscript function. Go to Report->Report Properties->Code tab.

Create a calculate function there passing in some parameters. I think you can even connect back to the database in that code. There is even a way to include a code reference so you can call an existing application.