Showing posts with label properties. Show all posts
Showing posts with label properties. Show all posts

Friday, March 30, 2012

Passing object properties to variables

Hi.

I was wondering if it's possible to pass object properties to variables? For example, if I have a ConnectionString property for a SQL Server connection, would it be possible to pass this value to a User-scoped variable?

Any ideas would be appreciated. Thanks!

One way you could accomplish this is by using a Script task.

You can access the properties of all the connections in your Connection Manager through the Dts ScriptObjectModel .

For example, the following code grabs the ConnectionString of my "currentFolder" connection object, and stores it in the "myConnectionString" variable.

PublicSub Main()

Dim value AsString

value = Dts.Connections("currentFolder").ConnectionString

Dts.Variables("myConnectionString").Value = value

'MsgBox(Dts.Variables("myConnectionString").Value)

Dts.TaskResult = Dts.Results.Success

EndSub

Be sure to include your variable (ie. User::myConnectionString) in the ReadWriteVariables property of your script task.

Is this what you meant?

|||Yes, this is exactly what I meant. Smile Thanks!

Wednesday, March 28, 2012

Passing Multi-Valued Parameter to Subreport

I have a multi-valued parameter that I want to pass to a subreport. The values are 11, 12, 13, and 14.

So here's what I've done:

1. For the properties of the clickable field of the first report, I have gone to the Navigation tab and chosen the subreport in the "jump to report" pulldown.

2. Then I clicked on the Parameters button and added a parameter name for the multi-valued parameter I am trying to send. For the Parameter value, I have tried 11,12,13,14. I have also tried =Split(11,12,13,14)

3. On the subreport, I create a report parameter with the same name, data type is string, multi-value is checked, and the available values pulldown is populated by a query.

So I run the first report and click on the link that brings me to the subreport, but all the subreport shows is the results for 11, not 12, 13, and 14.

How can I get the second report to understand that I want it to show all the records related to 11, 12, 13, and 14? If I bypass the first report and simply use the drop-down to choose 11, 12, 13, and 14 in the subreport, it works fine. I just can't seem to figure out how to correctly have the first report tell the subreport that it wants 11, 12, 13, and 14.

Thanks in advance for any advice!

Dan

Hello Dan,

You should check out this post in which Robert explained a solution.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=164056&SiteID=1

Jarret

|||

Jarret,

Thank you so much! That post revealed my mistake. I was forgetting to specify the delimiter in the Split statement.

When I pass the following: =Split("11,12,13,14", ",") out of the first report
it works just fine.

Have a great day!
Dan