Showing posts with label previous. Show all posts
Showing posts with label previous. Show all posts

Friday, February 24, 2012

How to know the Reporting services version at runtime

HI, can anybody help me?
I have a problem. With the sqlserver 2005 sp2 some behavieur are differt from previous versions.
For example with service pack 1 there isn't the "select all" option for multi value parameters, so i add MY select all, but with service pack 2 there is the "select all" option for multivalue paramteres, so when my reports are running under a server with service pack 2 in the list of multivalue parameter I'm going to find "Select all" and "MY select all"
It is possible to know at runtime under which version my repors will be running? so I can use or not MY select all. (i cannot force client with a particular version)

Thank in advance

If you can call any webservice method (e.g. ListSecureMethods), you will get back a serverinfoheader, where you can look into reportserverversion property to determine the server version.

how to know status of previous control flow

Hi,

I have a package which has 3 data flows and a script component to write log file. Those 3 data flows are in sequence (mean upon success, next will run). If the first 2 data flows fails, control will go to script and upon completion of 3rd, control will go to script to create log file.

Now, my question is, within my script component, is there any way to find out what was the last ran data flow and its status? What I know is, adding a 'activex task' between each data flow and script component which updates a variable and then I can use that variable in the script component to know the last ran data flow. But what I want to know is, is there any system variable (or something) which will do the samething without any need to add additional task?

Thx.

Where you say script component I assume you mean script task? (the two are different you see)

There is no way of knowing what the previous task is unless you tell it. You are proposing to do this with an ActiveX Script task. I recommend you don't do that as the are only there for backward compatibility. Use a script task instead.

-Jamie

|||

If you mean a script task, you can do this as follows:

Create a string variable at the scope of the package - call it something like LastTask. http://msdn2.microsoft.com/en-us/library/ms141670(SQL.90).aspx

Create a sequence container and build your control flow inside the sequence - you can drag in existing objects, or copy and paste them in. http://msdn2.microsoft.com/en-us/library/ms139855.aspx

Create an OnPostExecute EventHandler for the sequence container. http://msdn2.microsoft.com/en-us/library/ms139744(SQL.90).aspx

Add a Script Task to the EventHandler. Configure the Script Task to use your LastTask variable as a ReadWrite variable and the system variable SourceName. (For detailed info on using variables with the script task see http://msdn2.microsoft.com/en-us/library/ms135941.aspx)

In the ScriptTask you could use the following line to set LastTask to the name of the last task to execute within the sequence ...

Dts.Variables("LastTask").Value = Dts.Variables("SourceName").Value

If you need to insert this value into a data flow, you could use the DerivedColumn component to insert the value of LastTask into a new column in each row passing.

hth

Donald

|||

Hi Donald,

Thx for giving me the perfect solution. I have couple of questions to that. The above method will tell me which is the last task. But how do I know the status of the task? Also in case of failure how do I know the error message?

Thx again.