Showing posts with label collection. Show all posts
Showing posts with label collection. Show all posts

Sunday, March 11, 2012

Custom Properties in External Metadata not writeable using the Advanced Editor

Hello,

I'm working on a custom dataflow destination component. It makes use of the External Metadata Collection. I also use Custom Properties with the external metadata collection.

When I open the destination component using the Advanced Editor, and select an External Metadata Collection and change the Custom Property it always changes back to the original value.

Additionally the method SetExternalMetadataColumnProperty never gets called.

Here is a little Test Component that surfaces the problem:

[DtsPipelineComponent(ComponentType=ComponentType.DestinationAdapter, DisplayName="Test Destination")]
public class Class1 : PipelineComponent
{
public override void ProvideComponentProperties()
{
base.ProvideComponentProperties();

ComponentMetaData.InputCollection.RemoveAll();
IDTSInput90 input = ComponentMetaData.InputCollection.New();
input.Name = "Name";
input.ExternalMetadataColumnCollection.IsUsed = true;

IDTSExternalMetadataColumn90 ext = input.ExternalMetadataColumnCollection.New();
ext.Name = "ExtName";
IDTSCustomProperty90 customProp = ext.CustomPropertyCollection.New();
customProp.Name = "Custom Property";
customProp.Value = "Hallo";
}

public override IDTSCustomProperty90 SetExternalMetadataColumnProperty(int iID, int iExternalMetadataColumnID, string strPropertyName, object oValue)
{
return base.SetExternalMetadataColumnProperty(iID, iExternalMetadataColumnID, strPropertyName, oValue);
}
}

Any ideas how to make that work?

Georg

Are you sure that your SetExternalMetadataColumnProperty method is getting called? I believe you must implement the functionality to set the property yourself rather than delegating to the base class.|||

No, actually part of problem is that it never gets called when I change the property.

The method is only implemented for debugging. If you set a breakpoint in it, it never gets called. As far as I understand is, you would override this method just to implement additional functionality when a custom property of an External Metadata Column is changed, eg for validation.

Friday, February 24, 2012

Custom coding

I'm using the Report.References collection to link to some external
Assemblies (developed in C#). Also, I use the Report.Classes collection to
instantiate some classes defined in that assemblies. This works, as I'm
able to show a custom Windows form from the constructors of the instantiated
classes in report initialization time and to get simple values from some
properties. As this approach is extremately useful, I'd like to acquire
maximum flexibility being able to access from these classes to all the
properties of the Report via the corresponding namespaces as follows:
Microsoft.ReportingServices.ReportProcessing
Microsoft.ReportingServices.ReportRendering
As an example, I'd like to access to the Report object, to an existing
Matrix item, etc. I'm trying it this way:
///////////////////////////// C# in the Assembly:
namespace CustomAssembly
{
public class Class1
{
public int
GetRenderedColumnsCount(Microsoft.ReportingServices.ReportRendering.Report
p_Report)
{
return p_Report.Columns;
}
public int
GetMatrixColumnsCount(Microsoft.ReportingServices.ReportRendering.Matrix
p_Matrix)
{
return p_Matrix.Columns;
}
}
}
/////////////////////////////// Report:
First, I reference the Assemblies:
<CodeModules>
<CodeModule>CustomAssembly, Version=1.0.1719.22270, Culture=neutral,
PublicKeyToken=null</CodeModule>
</CodeModules>
Second, I instantiate the Classes:
<Classes>
<Class>
<ClassName>CustomAssembly.Class1</ClassName>
<InstanceName>class1</InstanceName>
</Class>
</Classes>
Last, I tried to use the following expressions in a TextBox.Value but none
of them work:
=Code.class1.GetRenderedColumnsCount(Report)
=Code.class1.GetRenderedColumnsCount(Code.Report)
=Code.class1.GetMatrixColumnsCount(matrix1)
=Code.class1.GetMatrixColumnsCount(Report.matrix1)
=Code.class1.GetMatrixColumnsCount(Report!matrix1)
=Code.class1.GetMatrixColumnsCount(Report("matrix1"))
I'm sure the construction works because I'm showing a MessageBox in the
constructor and other properties are returning the proper value to the
report.
Can anyone, please, tell me what am I doing wrong?Hi.
I had this problem and was able to solve it by following these instructions.
Copy your custom assembly from your build location to the report server bin
folder or the Report Designer folder. The default location of the bin folder
for the report server is C:\Program Files\Microsoft SQL
Server\MSSQL\Reporting Services\ReportServer\bin. The default location of the
Report Designer is C:\Program Files\Microsoft SQL Server\80\Tools\Report
Designer.
It should then work
Christina
"Al Santamaria" wrote:
> I'm using the Report.References collection to link to some external
> Assemblies (developed in C#). Also, I use the Report.Classes collection to
> instantiate some classes defined in that assemblies. This works, as I'm
> able to show a custom Windows form from the constructors of the instantiated
> classes in report initialization time and to get simple values from some
> properties. As this approach is extremately useful, I'd like to acquire
> maximum flexibility being able to access from these classes to all the
> properties of the Report via the corresponding namespaces as follows:
> Microsoft.ReportingServices.ReportProcessing
> Microsoft.ReportingServices.ReportRendering
> As an example, I'd like to access to the Report object, to an existing
> Matrix item, etc. I'm trying it this way:
> ///////////////////////////// C# in the Assembly:
> namespace CustomAssembly
> {
> public class Class1
> {
> public int
> GetRenderedColumnsCount(Microsoft.ReportingServices.ReportRendering.Report
> p_Report)
> {
> return p_Report.Columns;
> }
> public int
> GetMatrixColumnsCount(Microsoft.ReportingServices.ReportRendering.Matrix
> p_Matrix)
> {
> return p_Matrix.Columns;
> }
> }
> }
> /////////////////////////////// Report:
> First, I reference the Assemblies:
> <CodeModules>
> <CodeModule>CustomAssembly, Version=1.0.1719.22270, Culture=neutral,
> PublicKeyToken=null</CodeModule>
> </CodeModules>
> Second, I instantiate the Classes:
> <Classes>
> <Class>
> <ClassName>CustomAssembly.Class1</ClassName>
> <InstanceName>class1</InstanceName>
> </Class>
> </Classes>
> Last, I tried to use the following expressions in a TextBox.Value but none
> of them work:
> =Code.class1.GetRenderedColumnsCount(Report)
> =Code.class1.GetRenderedColumnsCount(Code.Report)
> =Code.class1.GetMatrixColumnsCount(matrix1)
> =Code.class1.GetMatrixColumnsCount(Report.matrix1)
> =Code.class1.GetMatrixColumnsCount(Report!matrix1)
> =Code.class1.GetMatrixColumnsCount(Report("matrix1"))
> I'm sure the construction works because I'm showing a MessageBox in the
> constructor and other properties are returning the proper value to the
> report.
> Can anyone, please, tell me what am I doing wrong?
>
>