Showing posts with label programmatically. Show all posts
Showing posts with label programmatically. Show all posts

Thursday, March 22, 2012

Custom transform component, change type or add output column

Would anyone happen to have any pointers or know of any good code examples to either programmatically change the type of an input column when it is passed through the component, or add a new column to the output? I am extracting data from an Oracle database which is in Julian date format (represented within SSIS as a DT_NUMERIC column) and I need to to either transform the input column holding it into a date column, or to dynamically add a new output column holding the transformed data.

Many thanks

You cannot change the type of a buffer column. You will have to add a new column. If you only expect users to select valid columns, and for each one selected you could handle this by overriding SetUSageType on the component class.

Whenever people select a column (UsageType read-only, deny read-write as not required), you could then add a new output column. This would work and would be quite clean.

I would also use a custom property on the output column to store the lineage ID of the "source" inpurt column.

The better way would be to handle adding the column outside of SetUsageType. So with the Advanced UI you would need to select the input column (SetUsageType), then add the output column (InsertOutputColumnAt) and add the custom property (SetOutputColumnProperty) all in three steps. Method names used by the UI are shown in braclets so you know what to do if it was your own UI. With a proper custom UI this of course would become one step for the end user, but more importantly could all be done through the managed wrapper interface, CManagedComponentWrapperClass.SetUsageType, InsertOutputColumnAt, SetOutputColumnProperty methods. This would be good for the user experience it will give around real-time validation and OK/Cancel behaviour of the UI.

Monday, March 19, 2012

Custom report item

How would one go about setting the height of a custom report item programmatically?

I have a custom report item that renders back an image of indeterminate height. I cannot simply set RenderItem.Sizing = Image.Sizings.AutoSize; As the image is being rendered back at 300 dpi and will require being set to FitProportional. Therefore I need to set the height to a scale height. I've tried setting CRI.Height to a ReportSize value, but it tells me that I cannot because of the current state of the item.

I have also tried setting the Width and Height of the Microsoft.ReportingServices.ReportRendering.Image to the needed values, but that appears to be completely ignored when the report is generated.

Custom report item

How would one go about setting the height of a custom report item programmatically?

I have a custom report item that renders back an image of indeterminate height. I cannot simply set RenderItem.Sizing = Image.Sizings.AutoSize; As the image is being rendered back at 300 dpi and will require being set to FitProportional. Therefore I need to set the height to a scale height. I've tried setting CRI.Height to a ReportSize value, but it tells me that I cannot because of the current state of the item.

I have also tried setting the Width and Height of the Microsoft.ReportingServices.ReportRendering.Image to the needed values, but that appears to be completely ignored when the report is generated.

Wednesday, March 7, 2012

Custom Dataflow Transform in Programmatically Built Package

I'm building packages programmatically and all is well. I have a new custom transform that I developed. It also works fine. Now I'm trying to add my new component to my packages when I programmatically build them, and I'm unable to do that.

Has anyone added their own custom components to a programmatically built package successfully?

I get a COM error on the line that calls ProvideComponentProperties. I've attempted various modifications including not overriding ProvideComponentProperties or just having it do nothing. I always get the same result. What I don't understand is that the custom transform works and handles ProvideComponentProperties fine when it is added to a package in BIDS.

Thanks.

'Add new dataflow task

combitronics = dataFlow.ComponentMetaDataCollection.New()

'Set assembly to my component

combitronics.ComponentClassID = "Ewrap.SSIS.Combitronics"

'Get instance of component

Dim instance As CManagedComponentWrapper = combitronics.Instantiate()

'Initialize component ***Error Occurs Here***

instance.ProvideComponentProperties()

...

Have you tried debugging your custom component. The only other thing I could suggest is where the component is deployed to.|||

Thanks for the response.

It looks like I'm using the wrong name for my assembly when calling it. I found I could specify the GUID instead of the Namespace.Name format and that solved the problem. I got the correct GUID by looking at the .dtsx file after renaming it to .xml so it's easily viewed in IE.