Showing posts with label mimic. Show all posts
Showing posts with label mimic. Show all posts

Monday, March 19, 2012

Mimic the rowcount Transform''s variables dropdown?

I'm trying to mimic the rowcount transform's custom property called VariableName in a custom pipeline transform, with the same drop-down and list of variables in the default property grid as that of "RowCount".

Should a UITypeEditor or a TypeConverter be used for such a custom property? More importantly, in either case, how do you get from the UITypeEditor or TypeConverter to the TaskHost which contains the Variables to enumerate?

I'm not that familiar with Windows Forms, but it appears in both cases (editor or type converter), an ITypeDescriptorContext parameter named "context" is passed, but I'm certain how to get from A to B, that is, from the context variable to the TaskHost.

P.S. There's no need to add a new variable, just select from those that already exist.

Either a UITypeEditor or a TypeConverter could be used. I like the greater flexibility of a UITypeEditor for most things myself, but from memory I required one to give the better UE when creating variables, so as you just want to select, a TypeConverter should suffice and might be marginally simpler.

What type is context? What types are the properties of context, things like InnerObject? Examine what you are given, either context or a property of context will get you to where you need to be. It varies slightly depending on the host, the advanced UI or the property grid.

|||

It would seem like the appropriate route to use to mimic the VariableName drop-down in the RowCount transform would be to use IDTSPipelineEnvironmentService in a TypeConverter, which allows you to retrieve a component's TaskHost and its Variables collection.


But, I cannot find a way to get an IDTSPipelineEnvironmentService from within a TypeConverter on the Advanced Editor's property grid. Would you not agree that IDTSPipelineEnvironmentService is the way to get at the TaskHost from a transform's advanced editor, since that service is documented in BOL?

So I ended up using reflection (see the following Type Converter), which operates "correctly" ( creates a drop-down of variables' names) ... but the retrieval of a TaskHost and its Variables collection through reflection on non-public properties is not documented.

Code Snippet

// TaskHost scoped Variables for use in

// Pipeline Component's Advanced Editor (dropdown)

public sealed class VariablesConverter : TypeConverter

{

static StandardValuesCollection svc =

new StandardValuesCollection(new ArrayList());

public override bool

GetStandardValuesSupported(ITypeDescriptorContext context)

{

return true;

}

public override StandardValuesCollection

GetStandardValues(ITypeDescriptorContext context)

{

TaskHost th = null;

PropertyInfo tashHostProperty = null;

List<string> values = new List<string>();

if (context == null) { return svc; }

if (context.Instance == null) { return svc; }

tashHostProperty = context.Instance.GetType().GetProperty(

"PipelineTask", typeof(TaskHost));

// a => b ( Component => TaskHost via reflection ? )

if (tashHostProperty == null) { return svc; }

th = tashHostProperty.GetValue(context.Instance, null) as TaskHost;

if (th == null) { return svc; }

foreach (Variable v in th.Variables)

{

if (!v.SystemVariable && v.DataType == TypeCode.String)

{

values.Add(v.QualifiedName);

}

}

values.Sort();

return new StandardValuesCollection(values);

}

}


|||

I don't have a problem with the way it works, and it makes sense for the context to be as it is, rather than the IDTSPipelineEnvironmentService, but what is not documented is the type of context in the different hosts where you could be expected to provide editors or converters, such as the Advanced UI or the normal properties grid.

A custom UI will be friendlier still, although having the editor is no bad thing as well.

|||

Alright, I appreciate your insight on this one (about looking into ALL the properties on the ITypeDescriptorContext object ) when building UI widgets on the Advanced Editor.

In terms of friendliness, I'm starting to think its more "friendly" from a development perspective to build a custom UI for components/tasks/enumerators, since with a custom UI you're handed explicit references to service providers, and to relevant collections (like variables and connections)... and the documentation and examples generally use/describe custom UI development over use of the pre-provided Advanced Editor.

In any case, I went out and got a Windows forms book... of course, that may not be long for the world what with the 3.0 .NET Framework's WPF.

Monday, March 12, 2012

Mimic SQL Server Management Studio behavior inside RS Report

I want to know how to mimic the SSMS behavior inside an Reporting Services report when querying an XML field.

In SSMS, a field that is XML shows up as a link, and when the use clicks on the XML, it opens then entire XML document in a new window. I need this exact behavior in RS, but can't accomplish it.

Any smart people out there who can do this?

You would need to use a drillthrough or hyperlink action in the report. You could pass the value of the XML to the target URL.|||

Brian, thats the part that I dont understand. The target isn't in a file- it's in a field in the database. So, with one hyperlink action how do I extract the data, and present it in another IE window, formatted as XML (i.e. indentation, Expand/collapse nodes functionality, etc. like in IE or SSMS)

You say "pass the value of the XML". How do I construnct the hyperlink to do that? Just assign the field to the Drill to URL action? That seems to easy, but I'll give it a shot...

-Kory

|||

I didn't realize you were trying to get an interactive representation of the XML. You can't really accomplish what you want in a report as we don't deal with XML data hierarchically - the XML data extension will flatten it and the binding it into a textbox will simply display the string. (Native XML support is in the long term plans)

So, if you want an interactive view, I would create an ASPX page that took the XML data as a parameter and displayed the HTML then create a URL action to point to the page.

Mimic SQL Server environment

I have SQL Server 2000 installed on Windows 2003 server. SQL Server
environment was set up about a year ago. I would like to known all of the
items I need to look at on SQL Server to mimic this environment. I have
started with SQL Server configuration (sp_Configure).
What items am I missing to mimic SQL Server?
Thanks,
Depends on what you mean by mimic...
You might wish to ensure the IO subsystems are the same.
You might wish to ensure each database is set up similary in physical
structure as well as attributes ( sp_dboption)
You might with to ensure the logins match. ( look in books on line for log
shipping and there is a document about how to make the warm standby the
production server. It includes a section on making the logins and users
match.)
Think about whether replication needs to be matched.
Think about sql agent jobs, etc ( included in msdb).
Hope this helps...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Mark T." <Mark T.@.discussions.microsoft.com> wrote in message
news:D76C7697-5336-494A-ADA5-ABC75B7AB421@.microsoft.com...
> I have SQL Server 2000 installed on Windows 2003 server. SQL Server
> environment was set up about a year ago. I would like to known all of the
> items I need to look at on SQL Server to mimic this environment. I have
> started with SQL Server configuration (sp_Configure).
> What items am I missing to mimic SQL Server?
> Thanks,

Mimic SQL Server environment

I have SQL Server 2000 installed on Windows 2003 server. SQL Server
environment was set up about a year ago. I would like to known all of the
items I need to look at on SQL Server to mimic this environment. I have
started with SQL Server configuration (sp_Configure).
What items am I missing to mimic SQL Server?
Thanks,Depends on what you mean by mimic...
You might wish to ensure the IO subsystems are the same.
You might wish to ensure each database is set up similary in physical
structure as well as attributes ( sp_dboption)
You might with to ensure the logins match. ( look in books on line for log
shipping and there is a document about how to make the warm standby the
production server. It includes a section on making the logins and users
match.)
Think about whether replication needs to be matched.
Think about sql agent jobs, etc ( included in msdb).
Hope this helps...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Mark T." <Mark T.@.discussions.microsoft.com> wrote in message
news:D76C7697-5336-494A-ADA5-ABC75B7AB421@.microsoft.com...
> I have SQL Server 2000 installed on Windows 2003 server. SQL Server
> environment was set up about a year ago. I would like to known all of the
> items I need to look at on SQL Server to mimic this environment. I have
> started with SQL Server configuration (sp_Configure).
> What items am I missing to mimic SQL Server?
> Thanks,

Mimic SQL Server environment

I have SQL Server 2000 installed on Windows 2003 server. SQL Server
environment was set up about a year ago. I would like to known all of the
items I need to look at on SQL Server to mimic this environment. I have
started with SQL Server configuration (sp_Configure).
What items am I missing to mimic SQL Server?
Thanks,Depends on what you mean by mimic...
You might wish to ensure the IO subsystems are the same.
You might wish to ensure each database is set up similary in physical
structure as well as attributes ( sp_dboption)
You might with to ensure the logins match. ( look in books on line for log
shipping and there is a document about how to make the warm standby the
production server. It includes a section on making the logins and users
match.)
Think about whether replication needs to be matched.
Think about sql agent jobs, etc ( included in msdb).
Hope this helps...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Mark T." <Mark T.@.discussions.microsoft.com> wrote in message
news:D76C7697-5336-494A-ADA5-ABC75B7AB421@.microsoft.com...
> I have SQL Server 2000 installed on Windows 2003 server. SQL Server
> environment was set up about a year ago. I would like to known all of the
> items I need to look at on SQL Server to mimic this environment. I have
> started with SQL Server configuration (sp_Configure).
> What items am I missing to mimic SQL Server?
> Thanks,

Mimic DBCC Memusage

Does anyone have a routine that returns results like DBCC MEMUSAGE used to return in older versions of SQL Server?

I think sys.dm_os_buffer_descriptors gets you close. Books Online shows a query that assembles some of the data you are looking for. I've modified this to be a bit more user-friendly.

Hope this helps,
Bryan

Code Snippet

SELECT

x.name,

obj.name as [object_name],

index_id,

count(*)AS cached_pages_count,

is_modified

FROMsys.dm_os_buffer_descriptorsAS bd

INNERJOIN

(

SELECTobject_name(object_id)ASname

,index_id ,allocation_unit_id

FROMsys.allocation_unitsAS au

INNERJOINsys.partitionsAS p

ON au.container_id = p.hobt_id

AND(au.type = 1 OR au.type = 3)

UNION ALL

SELECTobject_name(object_id)ASname

,index_id, allocation_unit_id

FROMsys.allocation_unitsAS au

INNERJOINsys.partitionsAS p

ON au.container_id = p.hobt_id

AND au.type = 2

)AS obj

ON bd.allocation_unit_id = obj.allocation_unit_id

innerjoinsys.databases x

on bd.database_id=x.database_id

GROUPBY x.name, obj.name,index_id, is_modified

ORDERBY 1, 2, 3, 5

|||

Thanks, Bryan. This is similar to what I presently have, but it might fix the problems; hang on and I'll give this a try.

This looks pretty good; thank you.