Showing posts with label visibility. Show all posts
Showing posts with label visibility. Show all posts

Monday, March 26, 2012

Parent Package Variable visibility when designing packages

I've created an SSIS package that uses parent package variables at several steps in the data flow. However, those parent package variables are only visible during runtime, making debugging the package practically impossible. Let me give you a simplified example:

In the parent package, I have a string variable named "sqlLookup" that looks like this:

"SELECT * from tblTest WHERE city = " + @.city

Also in the parent package is a variable named "city" which I can set to the name of the city that I want to query on. This dynamically updates the sqlLookup variable, which is being evaluated as an expression.

In the child package, I have an OLE DB Source control which is using the "sqlLookup" variable for its query. I have set up my parent package variable configuration, and it works when I run the package.

The problem is this...when I open the child package, I get an error on the OLE DB Source control using the parent package variable, "Command text was not set for the command object". Presumably, this is because the parent package variable is only available during run-time, and not at design time. And, if metadata changes (which it has), I can't get into the OLE DB Source control to edit it, because it throws the error.

So, my question is this: are there any workarounds for this problem? Is there a better way to do this? This seems like such an obvious problem that I'm wondering if I either missed a step somewhere, or if I'm just doing it the wrong way.

Thanks!

Try setting DelayValidation=TRUE on the data-flow task in the child package.

If that fails, set Work Offline on the SSIS menu.

-Jamie

|||

Jamie,

Thanks for the reply, however I'm not having any luck with either of your suggestions. I created a new Project from scratch to simplify the problem.

My Project contains two files, parent.dtsx and child.dtsx.

parent.dtsx contains only an Execute Package task pointing to child.dtsx, and one string variable called sqlGetNames, which is set to " SELECT * from tblCustomers WHERE city = 'Denver' "

child.dtsx contains a single Data Flow, with one OLE DB Source control. It contains one variable, also called "sqlGetNames". I have enabled Package Configurations, and created a Parent Package Variable that should get the value of sqlGetNames from the parent.

However, when I go into my OLE DB Source control in the child package, I get the following error when I tell it to use sqlGetNames as the variable for the SQL command:

Error at Data Flow Task [OLE DB Source[1]]: An OLE DB error has occurred. Error code: 0x80040E0C. An OLE DB record is available. Source: "OraOLEDB" Hresult: 0x80040E0C Description: "Command text was not set for the command object.".

I get this error whether or not I have DelayValidation set to False. If I set SSIS to work offline, then I can't set up the OLE DB Source control because there is no connection.

Any other ideas?

|||It may work if you set the child package's variable to have an initial value that works at design time, ie child.sqlGetNames = "SELECT * from tblCustomers"|||

Thanks. That's not exactly what I was hoping for, but it's a useful workaround. I appreciate the suggestion.

Monday, March 12, 2012

Parameters visibility

Hi,

In Report Parameters, there is a settings "Hidden". Once it is clicked, the parameter will be hidden from users.

However, can I make its visibility according to some conditions? Such as when some items in the reports being clicked, or when the parameter drop down list only contain one option?

Thanks in advance.

If you are using the reportviewer controls, you can do this by using the ReportViewer.ServerReport.SetParameters method. The ReportParameter object has a property for visibility.

|||Can you elaborate on this? I'm not sure how/where to use the SetParameters method.

I assumed there would be the ability to use expressions for parameter visibility.
|||

There are two places you can control parameter visibility.

The first is from the report definition itself. This is the hidden flag you mentioned. This setting is constant for the report and can't be set to an expression.

The second place to set visibility depends on how you are viewing the report. If you are using URL access directly to the report server or Report Manager, you can't set parameter visibility on an individual parameters basis (you can turn off the entire parameters area using url access to the server). If you are using the ReportViewer controls (either winforms or webforms) that ship with VS 2005, you can use the ReportViewer.ServerReport.SetParameters() call to tell the control to override the visibility setting in the definition. Note that you can only force the parameter hidden, you can't force a parameter to be visible if the report definition has hidden set.

Parameters visibility

Hi,

In Report Parameters, there is a settings "Hidden". Once it is clicked, the parameter will be hidden from users.

However, can I make its visibility according to some conditions? Such as when some items in the reports being clicked, or when the parameter drop down list only contain one option?

Thanks in advance.

If you are using the reportviewer controls, you can do this by using the ReportViewer.ServerReport.SetParameters method. The ReportParameter object has a property for visibility.

|||Can you elaborate on this? I'm not sure how/where to use the SetParameters method.

I assumed there would be the ability to use expressions for parameter visibility.
|||

There are two places you can control parameter visibility.

The first is from the report definition itself. This is the hidden flag you mentioned. This setting is constant for the report and can't be set to an expression.

The second place to set visibility depends on how you are viewing the report. If you are using URL access directly to the report server or Report Manager, you can't set parameter visibility on an individual parameters basis (you can turn off the entire parameters area using url access to the server). If you are using the ReportViewer controls (either winforms or webforms) that ship with VS 2005, you can use the ReportViewer.ServerReport.SetParameters() call to tell the control to override the visibility setting in the definition. Note that you can only force the parameter hidden, you can't force a parameter to be visible if the report definition has hidden set.