Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Wednesday, March 21, 2012

Current package reference.

hi

Iam developing a custom ssis source component, in that i need to get the reference of the current package where this component is added. I can get get the reference of the current package using this line of code

Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();

Microsoft.SqlServer.Dts.Runtime.Package pak = app.LoadPackage(@."C\DTS\Package1.dtsx",null);

Here i need to pass the path of the package. Is there any other way to get it (without the path)?

Thanks

Mani

You cannot get reference to the task or package from a component at run-time. The most you can do is to use variables. This is a deliberate design decision taken by MS early on with SSIS, to prevent self-modifying packages amongst other issues.

LoadPackage obviously requires the full path, and there is no other way. I would normally look to get a contextual reference to a parent object, but as a above this will not happen.

If you explain why you want to do this, we may be offer an alternative.

|||

hi

I require the package reference to get the list of variables in that particular package. I tried using the

VariableDispenser method, but to get a variable it should be lock for read, for that the name of the variable is required. Is there any other method to do this?

Thanks

Mani

|||

What is wrong with using the VariableDispenser? Why would you want another method? The VariableDispenser is available from the base class you inherit when creating pipeline component, so it is available to you. Yes you have to ock variables, but again what is the problem with doing this?

IDTSVariables90 variables = null;

VariableDispenser.LockOneForRead("TableName", ref variables);

string tableName = variable.Value.ToString();

variables.Unlock()

|||

hi

My problem is that i need to get the list of variables in the current package (without knowing their names). I need to list their names in the custom UI of the component as does the OLEDB component. Is there any method to do this?

Thanks

Mani

|||

This is where being clear in what you are trying to do and when will help. As I think I have pointed out there is no way or any need for you to enumerate variables at run-time.

At design-time I agree that this is higly desirable, and of course you can.

When building a UI, you will be using the IDtsComponentUI class, and notably the Edit method. This passes in a Variables collection which you can use, passing through to your form. You will probably also want the IDtsVariableService, which gives you a nice UI for creating variables as well. For this you use the IDtsComponentUI.Initialize method. One of the parameters is the IServiceProvider, which can be used to get the variable service. Cache the provider in a class level variable so you can access it in the Edit method, and pass through to with your UI. Convert it like this-

IDtsVariableService errorCollectionService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

|||

Why is it not possible to iterate the variables? If I want to capture variables (ie at the time of an error), I have to have a specific list of names that I want to capture for debugging purposes? Is there a list somewhere that lists all the variables that are available? What about variables that are added by other components that could help with debugging when an error is caused later on in the control flow or dataflow?

I'm just missing something completely here. Variables should be public or private and if you have them in a collection, (which they are), you should be able to iterate over them. Moreover, variables are such a basic part of any process, it should be dead simple on how they can / should be used.

|||

You can iterate variables, but not always. As above, I don't see it as an issue since you can do so at the approptiate times.

Yes, if you write some code/tasks in an On Error event, you do need to know in advance the variables you wish to read. The whole point is you would set this up at design-time. Do you expect your package to dynamically change during execution? This will not happen, and cannot happen at all in SSIS.

Components will not add any variables at runtime, so design-tme again.

Using variables is very simple. Do you actually have a real-world requirement that you could use to illustrate what you really want to do? You seem to be blustering about a problem that I don't think is there.

|||

Darren,

It baffles my mind that you cannot see why manidas wants to iterate through the variable collection at run time. Let me give some examples of why this would be nice to have and maybe you can then see the light.

1) Let's say I've got a package that pulls some startup variable values from a configuration files and the package is not working as I expect. I would want to see what the variables were at some point in time to help me troubleshoot my problem. Yes, I could write code that explicitly retrieved the values of each and every variable but that could be a lot of code when all you should have to do is write somethign to loop over the collection. Also, let's say I add or remove a variable. Now I have to go to all the places that I placed this code and update it.

2) It's pretty painful right now when you're editing a script (and you are using variables) because you can't get to the variable list while you're in the script editor. It would be nice if you could output all the variables to text and then copy and paste them into your code as you need them.

3) Almost all of my DTS packages get called from a SQL Agent Job so I send an email to myself when I'm done. Right now I use the connection collection to display the connections I'm using in the email. It would be nice to include the variables in that email as well.

Now, after just these three examples off the top of my head, if you can't see why not having access to the variables collection would be useful then either your logic skills are a bit lacking or you're trying to make excuses for something that isn't there but should be.

I'm not trying to be antagonistic but I am going to tell it like it is. If you want to debate this then I'm perfectly happy to respond to any reply you have to offer.|||

Sorry we are a newbie,

I want to add a dataflow task programmatically in the script task using the current package, Under dataflow task also create a new source and destination adapters,which uses the connection managers created. finally do copy column mapping and execute the dataflow. Is it possible? Did I mean here that it is a self modifying package. The above code gives me the current package reference using the path. Would you please give me hint of code how I can go about adding Dataflow task to the current package.

Thanks

Subhash Subramanyam

Bhavana Anand.

|||The current version of SSIS does not support adding or creating new tasks or data flows to a running package. You would have to generate a seperate package, which you could then call from the package that generates it.|||

HI,

Thank you very much for the forum. It is very helpfull to us to create new variables at runtime in UI. But we need to fill varibale details in combobox.

I used this below statement to create new varibale.

private IWin32Window parentWindow;

private DtsContainer dtsContainer;

private Variables vars;

System.IServiceProvider _serviceProvider;

private IDtsVariableService _dtsVariableService;

_dtsVariableService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

_dtsVariableService.PromptAndCreateVariable(parentWindow, dtsContainer);

Through this code i have created new varibale in varibale window at runtime in UI. But we are not able to get details of varibales which i create at runtime.

Thanks in Advance

ashok mohanty

|||

I don't get what you are asking. Can we clarify that when we refer to runtime, we mean that the package is executing. Design-time is when the user interface is manipulating the package or task. So a task UI can be running, but that is termed design-time for the package and dicussions above.

You can only create variables and manipulate objects at (package) design-time. You cannot create a variable at (package) runtime, so your statement "we are not able to get details of varibales which i create at runtime" does not make sense. You cannot get details, becaue you cannot create them so there are no details to get.

If you have a task designer or UI, and want a list of variables, look at the TaskHost parameter of the IDtsTaskUI.Initialize method, as it has the Variables collection as a property.

|||

If you just want to read the variables from the User Interface then it is easiest to just the "Variables vars" variable that should have been passed through to the UserInterface form in the constructor.

Then you can simply refrence the package paramaters either by iterating through them or using their name.

e.g. vars["Name_Of_Parameter"].Value

Current package reference.

hi

Iam developing a custom ssis source component, in that i need to get the reference of the current package where this component is added. I can get get the reference of the current package using this line of code

Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();

Microsoft.SqlServer.Dts.Runtime.Package pak = app.LoadPackage(@."C\DTS\Package1.dtsx",null);

Here i need to pass the path of the package. Is there any other way to get it (without the path)?

Thanks

Mani

You cannot get reference to the task or package from a component at run-time. The most you can do is to use variables. This is a deliberate design decision taken by MS early on with SSIS, to prevent self-modifying packages amongst other issues.

LoadPackage obviously requires the full path, and there is no other way. I would normally look to get a contextual reference to a parent object, but as a above this will not happen.

If you explain why you want to do this, we may be offer an alternative.

|||

hi

I require the package reference to get the list of variables in that particular package. I tried using the

VariableDispenser method, but to get a variable it should be lock for read, for that the name of the variable is required. Is there any other method to do this?

Thanks

Mani

|||

What is wrong with using the VariableDispenser? Why would you want another method? The VariableDispenser is available from the base class you inherit when creating pipeline component, so it is available to you. Yes you have to ock variables, but again what is the problem with doing this?

IDTSVariables90 variables = null;

VariableDispenser.LockOneForRead("TableName", ref variables);

string tableName = variable.Value.ToString();

variables.Unlock()

|||

hi

My problem is that i need to get the list of variables in the current package (without knowing their names). I need to list their names in the custom UI of the component as does the OLEDB component. Is there any method to do this?

Thanks

Mani

|||

This is where being clear in what you are trying to do and when will help. As I think I have pointed out there is no way or any need for you to enumerate variables at run-time.

At design-time I agree that this is higly desirable, and of course you can.

When building a UI, you will be using the IDtsComponentUI class, and notably the Edit method. This passes in a Variables collection which you can use, passing through to your form. You will probably also want the IDtsVariableService, which gives you a nice UI for creating variables as well. For this you use the IDtsComponentUI.Initialize method. One of the parameters is the IServiceProvider, which can be used to get the variable service. Cache the provider in a class level variable so you can access it in the Edit method, and pass through to with your UI. Convert it like this-

IDtsVariableService errorCollectionService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

|||

Why is it not possible to iterate the variables? If I want to capture variables (ie at the time of an error), I have to have a specific list of names that I want to capture for debugging purposes? Is there a list somewhere that lists all the variables that are available? What about variables that are added by other components that could help with debugging when an error is caused later on in the control flow or dataflow?

I'm just missing something completely here. Variables should be public or private and if you have them in a collection, (which they are), you should be able to iterate over them. Moreover, variables are such a basic part of any process, it should be dead simple on how they can / should be used.

|||

You can iterate variables, but not always. As above, I don't see it as an issue since you can do so at the approptiate times.

Yes, if you write some code/tasks in an On Error event, you do need to know in advance the variables you wish to read. The whole point is you would set this up at design-time. Do you expect your package to dynamically change during execution? This will not happen, and cannot happen at all in SSIS.

Components will not add any variables at runtime, so design-tme again.

Using variables is very simple. Do you actually have a real-world requirement that you could use to illustrate what you really want to do? You seem to be blustering about a problem that I don't think is there.

|||

Darren,

It baffles my mind that you cannot see why manidas wants to iterate through the variable collection at run time. Let me give some examples of why this would be nice to have and maybe you can then see the light.

1) Let's say I've got a package that pulls some startup variable values from a configuration files and the package is not working as I expect. I would want to see what the variables were at some point in time to help me troubleshoot my problem. Yes, I could write code that explicitly retrieved the values of each and every variable but that could be a lot of code when all you should have to do is write somethign to loop over the collection. Also, let's say I add or remove a variable. Now I have to go to all the places that I placed this code and update it.

2) It's pretty painful right now when you're editing a script (and you are using variables) because you can't get to the variable list while you're in the script editor. It would be nice if you could output all the variables to text and then copy and paste them into your code as you need them.

3) Almost all of my DTS packages get called from a SQL Agent Job so I send an email to myself when I'm done. Right now I use the connection collection to display the connections I'm using in the email. It would be nice to include the variables in that email as well.

Now, after just these three examples off the top of my head, if you can't see why not having access to the variables collection would be useful then either your logic skills are a bit lacking or you're trying to make excuses for something that isn't there but should be.

I'm not trying to be antagonistic but I am going to tell it like it is. If you want to debate this then I'm perfectly happy to respond to any reply you have to offer.|||

Sorry we are a newbie,

I want to add a dataflow task programmatically in the script task using the current package, Under dataflow task also create a new source and destination adapters,which uses the connection managers created. finally do copy column mapping and execute the dataflow. Is it possible? Did I mean here that it is a self modifying package. The above code gives me the current package reference using the path. Would you please give me hint of code how I can go about adding Dataflow task to the current package.

Thanks

Subhash Subramanyam

Bhavana Anand.

|||The current version of SSIS does not support adding or creating new tasks or data flows to a running package. You would have to generate a seperate package, which you could then call from the package that generates it.|||

HI,

Thank you very much for the forum. It is very helpfull to us to create new variables at runtime in UI. But we need to fill varibale details in combobox.

I used this below statement to create new varibale.

private IWin32Window parentWindow;

private DtsContainer dtsContainer;

private Variables vars;

System.IServiceProvider _serviceProvider;

private IDtsVariableService _dtsVariableService;

_dtsVariableService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

_dtsVariableService.PromptAndCreateVariable(parentWindow, dtsContainer);

Through this code i have created new varibale in varibale window at runtime in UI. But we are not able to get details of varibales which i create at runtime.

Thanks in Advance

ashok mohanty

|||

I don't get what you are asking. Can we clarify that when we refer to runtime, we mean that the package is executing. Design-time is when the user interface is manipulating the package or task. So a task UI can be running, but that is termed design-time for the package and dicussions above.

You can only create variables and manipulate objects at (package) design-time. You cannot create a variable at (package) runtime, so your statement "we are not able to get details of varibales which i create at runtime" does not make sense. You cannot get details, becaue you cannot create them so there are no details to get.

If you have a task designer or UI, and want a list of variables, look at the TaskHost parameter of the IDtsTaskUI.Initialize method, as it has the Variables collection as a property.

Current package reference.

hi

Iam developing a custom ssis source component, in that i need to get the reference of the current package where this component is added. I can get get the reference of the current package using this line of code

Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();

Microsoft.SqlServer.Dts.Runtime.Package pak = app.LoadPackage(@."C\DTS\Package1.dtsx",null);

Here i need to pass the path of the package. Is there any other way to get it (without the path)?

Thanks

Mani

You cannot get reference to the task or package from a component at run-time. The most you can do is to use variables. This is a deliberate design decision taken by MS early on with SSIS, to prevent self-modifying packages amongst other issues.

LoadPackage obviously requires the full path, and there is no other way. I would normally look to get a contextual reference to a parent object, but as a above this will not happen.

If you explain why you want to do this, we may be offer an alternative.

|||

hi

I require the package reference to get the list of variables in that particular package. I tried using the

VariableDispenser method, but to get a variable it should be lock for read, for that the name of the variable is required. Is there any other method to do this?

Thanks

Mani

|||

What is wrong with using the VariableDispenser? Why would you want another method? The VariableDispenser is available from the base class you inherit when creating pipeline component, so it is available to you. Yes you have to ock variables, but again what is the problem with doing this?

IDTSVariables90 variables = null;

VariableDispenser.LockOneForRead("TableName", ref variables);

string tableName = variable.Value.ToString();

variables.Unlock()

|||

hi

My problem is that i need to get the list of variables in the current package (without knowing their names). I need to list their names in the custom UI of the component as does the OLEDB component. Is there any method to do this?

Thanks

Mani

|||

This is where being clear in what you are trying to do and when will help. As I think I have pointed out there is no way or any need for you to enumerate variables at run-time.

At design-time I agree that this is higly desirable, and of course you can.

When building a UI, you will be using the IDtsComponentUI class, and notably the Edit method. This passes in a Variables collection which you can use, passing through to your form. You will probably also want the IDtsVariableService, which gives you a nice UI for creating variables as well. For this you use the IDtsComponentUI.Initialize method. One of the parameters is the IServiceProvider, which can be used to get the variable service. Cache the provider in a class level variable so you can access it in the Edit method, and pass through to with your UI. Convert it like this-

IDtsVariableService errorCollectionService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

|||

Why is it not possible to iterate the variables? If I want to capture variables (ie at the time of an error), I have to have a specific list of names that I want to capture for debugging purposes? Is there a list somewhere that lists all the variables that are available? What about variables that are added by other components that could help with debugging when an error is caused later on in the control flow or dataflow?

I'm just missing something completely here. Variables should be public or private and if you have them in a collection, (which they are), you should be able to iterate over them. Moreover, variables are such a basic part of any process, it should be dead simple on how they can / should be used.

|||

You can iterate variables, but not always. As above, I don't see it as an issue since you can do so at the approptiate times.

Yes, if you write some code/tasks in an On Error event, you do need to know in advance the variables you wish to read. The whole point is you would set this up at design-time. Do you expect your package to dynamically change during execution? This will not happen, and cannot happen at all in SSIS.

Components will not add any variables at runtime, so design-tme again.

Using variables is very simple. Do you actually have a real-world requirement that you could use to illustrate what you really want to do? You seem to be blustering about a problem that I don't think is there.

|||

Darren,

It baffles my mind that you cannot see why manidas wants to iterate through the variable collection at run time. Let me give some examples of why this would be nice to have and maybe you can then see the light.

1) Let's say I've got a package that pulls some startup variable values from a configuration files and the package is not working as I expect. I would want to see what the variables were at some point in time to help me troubleshoot my problem. Yes, I could write code that explicitly retrieved the values of each and every variable but that could be a lot of code when all you should have to do is write somethign to loop over the collection. Also, let's say I add or remove a variable. Now I have to go to all the places that I placed this code and update it.

2) It's pretty painful right now when you're editing a script (and you are using variables) because you can't get to the variable list while you're in the script editor. It would be nice if you could output all the variables to text and then copy and paste them into your code as you need them.

3) Almost all of my DTS packages get called from a SQL Agent Job so I send an email to myself when I'm done. Right now I use the connection collection to display the connections I'm using in the email. It would be nice to include the variables in that email as well.

Now, after just these three examples off the top of my head, if you can't see why not having access to the variables collection would be useful then either your logic skills are a bit lacking or you're trying to make excuses for something that isn't there but should be.

I'm not trying to be antagonistic but I am going to tell it like it is. If you want to debate this then I'm perfectly happy to respond to any reply you have to offer.|||

Sorry we are a newbie,

I want to add a dataflow task programmatically in the script task using the current package, Under dataflow task also create a new source and destination adapters,which uses the connection managers created. finally do copy column mapping and execute the dataflow. Is it possible? Did I mean here that it is a self modifying package. The above code gives me the current package reference using the path. Would you please give me hint of code how I can go about adding Dataflow task to the current package.

Thanks

Subhash Subramanyam

Bhavana Anand.

|||The current version of SSIS does not support adding or creating new tasks or data flows to a running package. You would have to generate a seperate package, which you could then call from the package that generates it.|||

HI,

Thank you very much for the forum. It is very helpfull to us to create new variables at runtime in UI. But we need to fill varibale details in combobox.

I used this below statement to create new varibale.

private IWin32Window parentWindow;

private DtsContainer dtsContainer;

private Variables vars;

System.IServiceProvider _serviceProvider;

private IDtsVariableService _dtsVariableService;

_dtsVariableService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

_dtsVariableService.PromptAndCreateVariable(parentWindow, dtsContainer);

Through this code i have created new varibale in varibale window at runtime in UI. But we are not able to get details of varibales which i create at runtime.

Thanks in Advance

ashok mohanty

|||

I don't get what you are asking. Can we clarify that when we refer to runtime, we mean that the package is executing. Design-time is when the user interface is manipulating the package or task. So a task UI can be running, but that is termed design-time for the package and dicussions above.

You can only create variables and manipulate objects at (package) design-time. You cannot create a variable at (package) runtime, so your statement "we are not able to get details of varibales which i create at runtime" does not make sense. You cannot get details, becaue you cannot create them so there are no details to get.

If you have a task designer or UI, and want a list of variables, look at the TaskHost parameter of the IDtsTaskUI.Initialize method, as it has the Variables collection as a property.

sql

Current package reference.

hi

Iam developing a custom ssis source component, in that i need to get the reference of the current package where this component is added. I can get get the reference of the current package using this line of code

Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();

Microsoft.SqlServer.Dts.Runtime.Package pak = app.LoadPackage(@."C\DTS\Package1.dtsx",null);

Here i need to pass the path of the package. Is there any other way to get it (without the path)?

Thanks

Mani

You cannot get reference to the task or package from a component at run-time. The most you can do is to use variables. This is a deliberate design decision taken by MS early on with SSIS, to prevent self-modifying packages amongst other issues.

LoadPackage obviously requires the full path, and there is no other way. I would normally look to get a contextual reference to a parent object, but as a above this will not happen.

If you explain why you want to do this, we may be offer an alternative.

|||

hi

I require the package reference to get the list of variables in that particular package. I tried using the

VariableDispenser method, but to get a variable it should be lock for read, for that the name of the variable is required. Is there any other method to do this?

Thanks

Mani

|||

What is wrong with using the VariableDispenser? Why would you want another method? The VariableDispenser is available from the base class you inherit when creating pipeline component, so it is available to you. Yes you have to ock variables, but again what is the problem with doing this?

IDTSVariables90 variables = null;

VariableDispenser.LockOneForRead("TableName", ref variables);

string tableName = variable.Value.ToString();

variables.Unlock()

|||

hi

My problem is that i need to get the list of variables in the current package (without knowing their names). I need to list their names in the custom UI of the component as does the OLEDB component. Is there any method to do this?

Thanks

Mani

|||

This is where being clear in what you are trying to do and when will help. As I think I have pointed out there is no way or any need for you to enumerate variables at run-time.

At design-time I agree that this is higly desirable, and of course you can.

When building a UI, you will be using the IDtsComponentUI class, and notably the Edit method. This passes in a Variables collection which you can use, passing through to your form. You will probably also want the IDtsVariableService, which gives you a nice UI for creating variables as well. For this you use the IDtsComponentUI.Initialize method. One of the parameters is the IServiceProvider, which can be used to get the variable service. Cache the provider in a class level variable so you can access it in the Edit method, and pass through to with your UI. Convert it like this-

IDtsVariableService errorCollectionService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

|||

Why is it not possible to iterate the variables? If I want to capture variables (ie at the time of an error), I have to have a specific list of names that I want to capture for debugging purposes? Is there a list somewhere that lists all the variables that are available? What about variables that are added by other components that could help with debugging when an error is caused later on in the control flow or dataflow?

I'm just missing something completely here. Variables should be public or private and if you have them in a collection, (which they are), you should be able to iterate over them. Moreover, variables are such a basic part of any process, it should be dead simple on how they can / should be used.

|||

You can iterate variables, but not always. As above, I don't see it as an issue since you can do so at the approptiate times.

Yes, if you write some code/tasks in an On Error event, you do need to know in advance the variables you wish to read. The whole point is you would set this up at design-time. Do you expect your package to dynamically change during execution? This will not happen, and cannot happen at all in SSIS.

Components will not add any variables at runtime, so design-tme again.

Using variables is very simple. Do you actually have a real-world requirement that you could use to illustrate what you really want to do? You seem to be blustering about a problem that I don't think is there.

|||

Darren,

It baffles my mind that you cannot see why manidas wants to iterate through the variable collection at run time. Let me give some examples of why this would be nice to have and maybe you can then see the light.

1) Let's say I've got a package that pulls some startup variable values from a configuration files and the package is not working as I expect. I would want to see what the variables were at some point in time to help me troubleshoot my problem. Yes, I could write code that explicitly retrieved the values of each and every variable but that could be a lot of code when all you should have to do is write somethign to loop over the collection. Also, let's say I add or remove a variable. Now I have to go to all the places that I placed this code and update it.

2) It's pretty painful right now when you're editing a script (and you are using variables) because you can't get to the variable list while you're in the script editor. It would be nice if you could output all the variables to text and then copy and paste them into your code as you need them.

3) Almost all of my DTS packages get called from a SQL Agent Job so I send an email to myself when I'm done. Right now I use the connection collection to display the connections I'm using in the email. It would be nice to include the variables in that email as well.

Now, after just these three examples off the top of my head, if you can't see why not having access to the variables collection would be useful then either your logic skills are a bit lacking or you're trying to make excuses for something that isn't there but should be.

I'm not trying to be antagonistic but I am going to tell it like it is. If you want to debate this then I'm perfectly happy to respond to any reply you have to offer.|||

Sorry we are a newbie,

I want to add a dataflow task programmatically in the script task using the current package, Under dataflow task also create a new source and destination adapters,which uses the connection managers created. finally do copy column mapping and execute the dataflow. Is it possible? Did I mean here that it is a self modifying package. The above code gives me the current package reference using the path. Would you please give me hint of code how I can go about adding Dataflow task to the current package.

Thanks

Subhash Subramanyam

Bhavana Anand.

|||The current version of SSIS does not support adding or creating new tasks or data flows to a running package. You would have to generate a seperate package, which you could then call from the package that generates it.|||

HI,

Thank you very much for the forum. It is very helpfull to us to create new variables at runtime in UI. But we need to fill varibale details in combobox.

I used this below statement to create new varibale.

private IWin32Window parentWindow;

private DtsContainer dtsContainer;

private Variables vars;

System.IServiceProvider _serviceProvider;

private IDtsVariableService _dtsVariableService;

_dtsVariableService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

_dtsVariableService.PromptAndCreateVariable(parentWindow, dtsContainer);

Through this code i have created new varibale in varibale window at runtime in UI. But we are not able to get details of varibales which i create at runtime.

Thanks in Advance

ashok mohanty

|||

I don't get what you are asking. Can we clarify that when we refer to runtime, we mean that the package is executing. Design-time is when the user interface is manipulating the package or task. So a task UI can be running, but that is termed design-time for the package and dicussions above.

You can only create variables and manipulate objects at (package) design-time. You cannot create a variable at (package) runtime, so your statement "we are not able to get details of varibales which i create at runtime" does not make sense. You cannot get details, becaue you cannot create them so there are no details to get.

If you have a task designer or UI, and want a list of variables, look at the TaskHost parameter of the IDtsTaskUI.Initialize method, as it has the Variables collection as a property.

Tuesday, March 20, 2012

Current package reference.

hi

Iam developing a custom ssis source component, in that i need to get the reference of the current package where this component is added. I can get get the reference of the current package using this line of code

Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();

Microsoft.SqlServer.Dts.Runtime.Package pak = app.LoadPackage(@."C\DTS\Package1.dtsx",null);

Here i need to pass the path of the package. Is there any other way to get it (without the path)?

Thanks

Mani

You cannot get reference to the task or package from a component at run-time. The most you can do is to use variables. This is a deliberate design decision taken by MS early on with SSIS, to prevent self-modifying packages amongst other issues.

LoadPackage obviously requires the full path, and there is no other way. I would normally look to get a contextual reference to a parent object, but as a above this will not happen.

If you explain why you want to do this, we may be offer an alternative.

|||

hi

I require the package reference to get the list of variables in that particular package. I tried using the

VariableDispenser method, but to get a variable it should be lock for read, for that the name of the variable is required. Is there any other method to do this?

Thanks

Mani

|||

What is wrong with using the VariableDispenser? Why would you want another method? The VariableDispenser is available from the base class you inherit when creating pipeline component, so it is available to you. Yes you have to ock variables, but again what is the problem with doing this?

IDTSVariables90 variables = null;

VariableDispenser.LockOneForRead("TableName", ref variables);

string tableName = variable.Value.ToString();

variables.Unlock()

|||

hi

My problem is that i need to get the list of variables in the current package (without knowing their names). I need to list their names in the custom UI of the component as does the OLEDB component. Is there any method to do this?

Thanks

Mani

|||

This is where being clear in what you are trying to do and when will help. As I think I have pointed out there is no way or any need for you to enumerate variables at run-time.

At design-time I agree that this is higly desirable, and of course you can.

When building a UI, you will be using the IDtsComponentUI class, and notably the Edit method. This passes in a Variables collection which you can use, passing through to your form. You will probably also want the IDtsVariableService, which gives you a nice UI for creating variables as well. For this you use the IDtsComponentUI.Initialize method. One of the parameters is the IServiceProvider, which can be used to get the variable service. Cache the provider in a class level variable so you can access it in the Edit method, and pass through to with your UI. Convert it like this-

IDtsVariableService errorCollectionService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

|||

Why is it not possible to iterate the variables? If I want to capture variables (ie at the time of an error), I have to have a specific list of names that I want to capture for debugging purposes? Is there a list somewhere that lists all the variables that are available? What about variables that are added by other components that could help with debugging when an error is caused later on in the control flow or dataflow?

I'm just missing something completely here. Variables should be public or private and if you have them in a collection, (which they are), you should be able to iterate over them. Moreover, variables are such a basic part of any process, it should be dead simple on how they can / should be used.

|||

You can iterate variables, but not always. As above, I don't see it as an issue since you can do so at the approptiate times.

Yes, if you write some code/tasks in an On Error event, you do need to know in advance the variables you wish to read. The whole point is you would set this up at design-time. Do you expect your package to dynamically change during execution? This will not happen, and cannot happen at all in SSIS.

Components will not add any variables at runtime, so design-tme again.

Using variables is very simple. Do you actually have a real-world requirement that you could use to illustrate what you really want to do? You seem to be blustering about a problem that I don't think is there.

|||

Darren,

It baffles my mind that you cannot see why manidas wants to iterate through the variable collection at run time. Let me give some examples of why this would be nice to have and maybe you can then see the light.

1) Let's say I've got a package that pulls some startup variable values from a configuration files and the package is not working as I expect. I would want to see what the variables were at some point in time to help me troubleshoot my problem. Yes, I could write code that explicitly retrieved the values of each and every variable but that could be a lot of code when all you should have to do is write somethign to loop over the collection. Also, let's say I add or remove a variable. Now I have to go to all the places that I placed this code and update it.

2) It's pretty painful right now when you're editing a script (and you are using variables) because you can't get to the variable list while you're in the script editor. It would be nice if you could output all the variables to text and then copy and paste them into your code as you need them.

3) Almost all of my DTS packages get called from a SQL Agent Job so I send an email to myself when I'm done. Right now I use the connection collection to display the connections I'm using in the email. It would be nice to include the variables in that email as well.

Now, after just these three examples off the top of my head, if you can't see why not having access to the variables collection would be useful then either your logic skills are a bit lacking or you're trying to make excuses for something that isn't there but should be.

I'm not trying to be antagonistic but I am going to tell it like it is. If you want to debate this then I'm perfectly happy to respond to any reply you have to offer.|||

Sorry we are a newbie,

I want to add a dataflow task programmatically in the script task using the current package, Under dataflow task also create a new source and destination adapters,which uses the connection managers created. finally do copy column mapping and execute the dataflow. Is it possible? Did I mean here that it is a self modifying package. The above code gives me the current package reference using the path. Would you please give me hint of code how I can go about adding Dataflow task to the current package.

Thanks

Subhash Subramanyam

Bhavana Anand.

|||The current version of SSIS does not support adding or creating new tasks or data flows to a running package. You would have to generate a seperate package, which you could then call from the package that generates it.|||

HI,

Thank you very much for the forum. It is very helpfull to us to create new variables at runtime in UI. But we need to fill varibale details in combobox.

I used this below statement to create new varibale.

private IWin32Window parentWindow;

private DtsContainer dtsContainer;

private Variables vars;

System.IServiceProvider _serviceProvider;

private IDtsVariableService _dtsVariableService;

_dtsVariableService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

_dtsVariableService.PromptAndCreateVariable(parentWindow, dtsContainer);

Through this code i have created new varibale in varibale window at runtime in UI. But we are not able to get details of varibales which i create at runtime.

Thanks in Advance

ashok mohanty

|||

I don't get what you are asking. Can we clarify that when we refer to runtime, we mean that the package is executing. Design-time is when the user interface is manipulating the package or task. So a task UI can be running, but that is termed design-time for the package and dicussions above.

You can only create variables and manipulate objects at (package) design-time. You cannot create a variable at (package) runtime, so your statement "we are not able to get details of varibales which i create at runtime" does not make sense. You cannot get details, becaue you cannot create them so there are no details to get.

If you have a task designer or UI, and want a list of variables, look at the TaskHost parameter of the IDtsTaskUI.Initialize method, as it has the Variables collection as a property.

|||

If you just want to read the variables from the User Interface then it is easiest to just the "Variables vars" variable that should have been passed through to the UserInterface form in the constructor.

Then you can simply refrence the package paramaters either by iterating through them or using their name.

e.g. vars["Name_Of_Parameter"].Value

Current package reference.

hi

Iam developing a custom ssis source component, in that i need to get the reference of the current package where this component is added. I can get get the reference of the current package using this line of code

Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();

Microsoft.SqlServer.Dts.Runtime.Package pak = app.LoadPackage(@."C\DTS\Package1.dtsx",null);

Here i need to pass the path of the package. Is there any other way to get it (without the path)?

Thanks

Mani

You cannot get reference to the task or package from a component at run-time. The most you can do is to use variables. This is a deliberate design decision taken by MS early on with SSIS, to prevent self-modifying packages amongst other issues.

LoadPackage obviously requires the full path, and there is no other way. I would normally look to get a contextual reference to a parent object, but as a above this will not happen.

If you explain why you want to do this, we may be offer an alternative.

|||

hi

I require the package reference to get the list of variables in that particular package. I tried using the

VariableDispenser method, but to get a variable it should be lock for read, for that the name of the variable is required. Is there any other method to do this?

Thanks

Mani

|||

What is wrong with using the VariableDispenser? Why would you want another method? The VariableDispenser is available from the base class you inherit when creating pipeline component, so it is available to you. Yes you have to ock variables, but again what is the problem with doing this?

IDTSVariables90 variables = null;

VariableDispenser.LockOneForRead("TableName", ref variables);

string tableName = variable.Value.ToString();

variables.Unlock()

|||

hi

My problem is that i need to get the list of variables in the current package (without knowing their names). I need to list their names in the custom UI of the component as does the OLEDB component. Is there any method to do this?

Thanks

Mani

|||

This is where being clear in what you are trying to do and when will help. As I think I have pointed out there is no way or any need for you to enumerate variables at run-time.

At design-time I agree that this is higly desirable, and of course you can.

When building a UI, you will be using the IDtsComponentUI class, and notably the Edit method. This passes in a Variables collection which you can use, passing through to your form. You will probably also want the IDtsVariableService, which gives you a nice UI for creating variables as well. For this you use the IDtsComponentUI.Initialize method. One of the parameters is the IServiceProvider, which can be used to get the variable service. Cache the provider in a class level variable so you can access it in the Edit method, and pass through to with your UI. Convert it like this-

IDtsVariableService errorCollectionService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

|||

Why is it not possible to iterate the variables? If I want to capture variables (ie at the time of an error), I have to have a specific list of names that I want to capture for debugging purposes? Is there a list somewhere that lists all the variables that are available? What about variables that are added by other components that could help with debugging when an error is caused later on in the control flow or dataflow?

I'm just missing something completely here. Variables should be public or private and if you have them in a collection, (which they are), you should be able to iterate over them. Moreover, variables are such a basic part of any process, it should be dead simple on how they can / should be used.

|||

You can iterate variables, but not always. As above, I don't see it as an issue since you can do so at the approptiate times.

Yes, if you write some code/tasks in an On Error event, you do need to know in advance the variables you wish to read. The whole point is you would set this up at design-time. Do you expect your package to dynamically change during execution? This will not happen, and cannot happen at all in SSIS.

Components will not add any variables at runtime, so design-tme again.

Using variables is very simple. Do you actually have a real-world requirement that you could use to illustrate what you really want to do? You seem to be blustering about a problem that I don't think is there.

|||

Darren,

It baffles my mind that you cannot see why manidas wants to iterate through the variable collection at run time. Let me give some examples of why this would be nice to have and maybe you can then see the light.

1) Let's say I've got a package that pulls some startup variable values from a configuration files and the package is not working as I expect. I would want to see what the variables were at some point in time to help me troubleshoot my problem. Yes, I could write code that explicitly retrieved the values of each and every variable but that could be a lot of code when all you should have to do is write somethign to loop over the collection. Also, let's say I add or remove a variable. Now I have to go to all the places that I placed this code and update it.

2) It's pretty painful right now when you're editing a script (and you are using variables) because you can't get to the variable list while you're in the script editor. It would be nice if you could output all the variables to text and then copy and paste them into your code as you need them.

3) Almost all of my DTS packages get called from a SQL Agent Job so I send an email to myself when I'm done. Right now I use the connection collection to display the connections I'm using in the email. It would be nice to include the variables in that email as well.

Now, after just these three examples off the top of my head, if you can't see why not having access to the variables collection would be useful then either your logic skills are a bit lacking or you're trying to make excuses for something that isn't there but should be.

I'm not trying to be antagonistic but I am going to tell it like it is. If you want to debate this then I'm perfectly happy to respond to any reply you have to offer.|||

Sorry we are a newbie,

I want to add a dataflow task programmatically in the script task using the current package, Under dataflow task also create a new source and destination adapters,which uses the connection managers created. finally do copy column mapping and execute the dataflow. Is it possible? Did I mean here that it is a self modifying package. The above code gives me the current package reference using the path. Would you please give me hint of code how I can go about adding Dataflow task to the current package.

Thanks

Subhash Subramanyam

Bhavana Anand.

|||The current version of SSIS does not support adding or creating new tasks or data flows to a running package. You would have to generate a seperate package, which you could then call from the package that generates it.|||

HI,

Thank you very much for the forum. It is very helpfull to us to create new variables at runtime in UI. But we need to fill varibale details in combobox.

I used this below statement to create new varibale.

private IWin32Window parentWindow;

private DtsContainer dtsContainer;

private Variables vars;

System.IServiceProvider _serviceProvider;

private IDtsVariableService _dtsVariableService;

_dtsVariableService = _serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;

_dtsVariableService.PromptAndCreateVariable(parentWindow, dtsContainer);

Through this code i have created new varibale in varibale window at runtime in UI. But we are not able to get details of varibales which i create at runtime.

Thanks in Advance

ashok mohanty

|||

I don't get what you are asking. Can we clarify that when we refer to runtime, we mean that the package is executing. Design-time is when the user interface is manipulating the package or task. So a task UI can be running, but that is termed design-time for the package and dicussions above.

You can only create variables and manipulate objects at (package) design-time. You cannot create a variable at (package) runtime, so your statement "we are not able to get details of varibales which i create at runtime" does not make sense. You cannot get details, becaue you cannot create them so there are no details to get.

If you have a task designer or UI, and want a list of variables, look at the TaskHost parameter of the IDtsTaskUI.Initialize method, as it has the Variables collection as a property.

Thursday, March 8, 2012

Culture overriding custom format

Hi, I've been having a weird problem with a report I'm making. I've done douzan of em, and the problem only appeared in one. Let say I have a text field, and I give it a format property (for the sake of the example, imagine its a date, and I set it as yyyy/MM/dd. Same result if I would use an expression with the Format function).

Now, depending on culture, the slashes gets overrided. Everything else work (so if I put yyyy/MM, the format is recognised and the day won't show...but it will use dashes instead of slashes, for example, with us culture).

How do I get it to always respect my format? I have, like I said, douzans of other reports and it works fine, the format string gets applied exactly: I don't know what the hell I could have changed. All the culture settings are at default, like in the reports that do work... I've tried diff-ing the source, can't see anything weird, but I'm sure I'm just being blind.

Any ideas?

Thank you.

The DateSeparator is defined on the DateTimeFomatInfo objects and the slash is being "translated" to the current culture.

If there's not an option to have the slash in the format string not interpreted as a DateSeparator, the only thing I can think of is to add a .Replace(CultureInfo.CurrentCulture.DateTimeFormat.DateSeparator, "/") to the end of your Format statement.

|||

Just found this stumbling around on something else. Try "yyyy'/'mm'/'dd" as your format string. Found ithere, so you can fuss at Microsoft if it doesn't work.

|||

Makes sense. Yeah, escaping the slashes (let say, yyyy\/MM\/dd ) worked too.

But then, what do I do with numeric formats? (since the date was just an example). #,##0.00
Works fine in most of my reports, but in that particular one, no matter what format I put, the number gets translated with the current culture. What mostly gets me, is that it works in all the reports! Just not -that- one...ugh.|||

Those separators are also defined in a culture-specific way. I'd recheck that one report and make sure that you haven't accidentally specified a culture or that you did specify a culture on the other reports.

|||

Yup, you're right... I'm baffled, I tested the other reports, and not only did they have cultures set, but the formats never worked (I had a formula that switched the Language setting depending on a parameter set by the user, and the culture I always ended up printing my report coincidently had the correct separators).

My apologies for misleading you, I know it can be annoying when you're trying to help someone and they give you the wrong info :)

At least now I know I can backslash escape the magical separators... That is quite awkward that it does that, especially since its a bit different from the behavior of .NET formatters... Oh well!

Friday, February 24, 2012

Cube browsing for endusers

Hi all,

Browsing a cube using SQL server management studio and Analysis servcices project is possible. Is there any possibility to have custom application built to have the option of browisng without opening Studio management or analysis services project?

Purpose of this is simple. End user should simplay have measures and dimensions and he will just drag and drop in to the browse area.

One thing I really like about Microsoft is that almost anything is possible . Programming one cube/dimension browser yourself is quite an interesting task. I'd use AMO to get the cube and it's dimensions structures, and then I'd use those to build up MDX queries when the user drags-n-drops. To enumerate the cube and dimensions is very easy using AMO. The hard thing here is to convert the drag-n-dropping into well formed and accurate MDX. Like did they drop on columns, rows, as a filter etc? Which hierarchy and level did they expand/drill down?

Some resources:

Query using C#: http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=640

AS objects: http://technet.microsoft.com/en-us/library/ms124924.aspx

There is a good example on how to enumerate an OLAP db in the SQL Server samples, which can be downloaded here:

http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&displaylang=en

After installation the AMO browser is located at c:\Program Files\Microsoft SQL Server\90\Samples\Analysis Services\Programmability\AMO\AmoBrowser\

Else there is this ProClarity browser which allow end users (say management) to browse a cube in an intuitive way, but that one costs $$$.

Ctype from string to double not behaving as expected.

I tried posting this earlier, but it never showed up. Hopefully I don't
double post.
I was writing code for a custom dll earlier this morning where I ran into
some strange behavior for the IsNumeric function.
IsNumeric("$1,0562.00") was returning false
I thought that maybe this behavior was being cause by one of the "features"
of the IsNumeric function so I decided to do some more testing.
I created a web app on the same machine and ran the same code there
IsNumeric("$1,0562.00") was returning true with the web app.
I delved a little deeper and decided to research just what all IsNumeric
does to check for a numeric value. I didn't have to go far.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctisnumeric.asp
states
"It also returns True if Expression is a String that can be successfully
converted to a Double"
So I decided to test the following code in each environment.
ctype("$1,0562.00",double)
Sure enough within the web app it worked fine, but within a reporting
services custom dll it threw an exception.
Both the instance of reporting services and the webapp are being run and
compiled on the same machine. They are both running under the 1.1 framework.
It would make more sense to me that the code didn't behave the way I thought
it should if it was consistently misbehaving. :-)
It's quite possible there is something I'm missing here, but I'm just trying
to figure out the reason for the inconsistency.
I'm running Reporting Services 2003 with sp2 installed.
Anyone have any ideas?
Thanks,
NathanThat is odd. I tried in SSRS 2005 preview window just for giggles, returned
true as expected.
=IsNumeric("$1,0562.00")
"Nathan" <Nathan@.discussions.microsoft.com> wrote in message
news:4B24FE69-BCA8-48CF-8ECC-40F8FCCC5448@.microsoft.com...
>I tried posting this earlier, but it never showed up. Hopefully I don't
> double post.
> I was writing code for a custom dll earlier this morning where I ran into
> some strange behavior for the IsNumeric function.
> IsNumeric("$1,0562.00") was returning false
> I thought that maybe this behavior was being cause by one of the
> "features"
> of the IsNumeric function so I decided to do some more testing.
> I created a web app on the same machine and ran the same code there
> IsNumeric("$1,0562.00") was returning true with the web app.
> I delved a little deeper and decided to research just what all IsNumeric
> does to check for a numeric value. I didn't have to go far.
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctisnumeric.asp
> states
> "It also returns True if Expression is a String that can be successfully
> converted to a Double"
> So I decided to test the following code in each environment.
> ctype("$1,0562.00",double)
> Sure enough within the web app it worked fine, but within a reporting
> services custom dll it threw an exception.
> Both the instance of reporting services and the webapp are being run and
> compiled on the same machine. They are both running under the 1.1
> framework.
> It would make more sense to me that the code didn't behave the way I
> thought
> it should if it was consistently misbehaving. :-)
> It's quite possible there is something I'm missing here, but I'm just
> trying
> to figure out the reason for the inconsistency.
> I'm running Reporting Services 2003 with sp2 installed.
> Anyone have any ideas?
> Thanks,
> Nathan
>|||Perhaps this was something that was fixed with 2005? Although I'm still not
ruling out that I'm missing something. When you say in the preview window do
you mean you used â'ctype("$1,0562.00",double)â' in the custom code window
there? Iâ'll have to give that a try and see if it has the same behavior as
calling it within a custom dll.
"Steve MunLeeuw" wrote:
> That is odd. I tried in SSRS 2005 preview window just for giggles, returned
> true as expected.
> =IsNumeric("$1,0562.00")
> "Nathan" <Nathan@.discussions.microsoft.com> wrote in message
> news:4B24FE69-BCA8-48CF-8ECC-40F8FCCC5448@.microsoft.com...
> >I tried posting this earlier, but it never showed up. Hopefully I don't
> > double post.
> >
> > I was writing code for a custom dll earlier this morning where I ran into
> > some strange behavior for the IsNumeric function.
> > IsNumeric("$1,0562.00") was returning false
> > I thought that maybe this behavior was being cause by one of the
> > "features"
> > of the IsNumeric function so I decided to do some more testing.
> > I created a web app on the same machine and ran the same code there
> > IsNumeric("$1,0562.00") was returning true with the web app.
> >
> > I delved a little deeper and decided to research just what all IsNumeric
> > does to check for a numeric value. I didn't have to go far.
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctisnumeric.asp
> > states
> > "It also returns True if Expression is a String that can be successfully
> > converted to a Double"
> >
> > So I decided to test the following code in each environment.
> > ctype("$1,0562.00",double)
> > Sure enough within the web app it worked fine, but within a reporting
> > services custom dll it threw an exception.
> >
> > Both the instance of reporting services and the webapp are being run and
> > compiled on the same machine. They are both running under the 1.1
> > framework.
> > It would make more sense to me that the code didn't behave the way I
> > thought
> > it should if it was consistently misbehaving. :-)
> > It's quite possible there is something I'm missing here, but I'm just
> > trying
> > to figure out the reason for the inconsistency.
> >
> > I'm running Reporting Services 2003 with sp2 installed.
> >
> > Anyone have any ideas?
> >
> > Thanks,
> >
> > Nathan
> >
>
>|||I just entered it as an expression in a textbox and clicked the Preview tab
in the Report Designer (VS IDE)
"Nathan" <Nathan@.discussions.microsoft.com> wrote in message
news:E814C5A0-E41D-4261-8A37-7ECB30C98D68@.microsoft.com...
> Perhaps this was something that was fixed with 2005? Although I'm still
> not
> ruling out that I'm missing something. When you say in the preview window
> do
> you mean you used "ctype("$1,0562.00",double)" in the custom code window
> there? I'll have to give that a try and see if it has the same behavior
> as
> calling it within a custom dll.
> "Steve MunLeeuw" wrote:
>> That is odd. I tried in SSRS 2005 preview window just for giggles,
>> returned
>> true as expected.
>> =IsNumeric("$1,0562.00")
>> "Nathan" <Nathan@.discussions.microsoft.com> wrote in message
>> news:4B24FE69-BCA8-48CF-8ECC-40F8FCCC5448@.microsoft.com...
>> >I tried posting this earlier, but it never showed up. Hopefully I don't
>> > double post.
>> >
>> > I was writing code for a custom dll earlier this morning where I ran
>> > into
>> > some strange behavior for the IsNumeric function.
>> > IsNumeric("$1,0562.00") was returning false
>> > I thought that maybe this behavior was being cause by one of the
>> > "features"
>> > of the IsNumeric function so I decided to do some more testing.
>> > I created a web app on the same machine and ran the same code there
>> > IsNumeric("$1,0562.00") was returning true with the web app.
>> >
>> > I delved a little deeper and decided to research just what all
>> > IsNumeric
>> > does to check for a numeric value. I didn't have to go far.
>> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctisnumeric.asp
>> > states
>> > "It also returns True if Expression is a String that can be
>> > successfully
>> > converted to a Double"
>> >
>> > So I decided to test the following code in each environment.
>> > ctype("$1,0562.00",double)
>> > Sure enough within the web app it worked fine, but within a reporting
>> > services custom dll it threw an exception.
>> >
>> > Both the instance of reporting services and the webapp are being run
>> > and
>> > compiled on the same machine. They are both running under the 1.1
>> > framework.
>> > It would make more sense to me that the code didn't behave the way I
>> > thought
>> > it should if it was consistently misbehaving. :-)
>> > It's quite possible there is something I'm missing here, but I'm just
>> > trying
>> > to figure out the reason for the inconsistency.
>> >
>> > I'm running Reporting Services 2003 with sp2 installed.
>> >
>> > Anyone have any ideas?
>> >
>> > Thanks,
>> >
>> > Nathan
>> >
>>|||Putting the "ctype("$1,0562.00",double)" directly in the cell on a page seems
to work fine. It seems to be when the code is run in a custom dll that the
problem occurs.
Can anyone else reproduce this?
Thanks,
-Nathan
"Steve MunLeeuw" wrote:
> I just entered it as an expression in a textbox and clicked the Preview tab
> in the Report Designer (VS IDE)
>
> "Nathan" <Nathan@.discussions.microsoft.com> wrote in message
> news:E814C5A0-E41D-4261-8A37-7ECB30C98D68@.microsoft.com...
> > Perhaps this was something that was fixed with 2005? Although I'm still
> > not
> > ruling out that I'm missing something. When you say in the preview window
> > do
> > you mean you used "ctype("$1,0562.00",double)" in the custom code window
> > there? I'll have to give that a try and see if it has the same behavior
> > as
> > calling it within a custom dll.
> > "Steve MunLeeuw" wrote:
> >
> >> That is odd. I tried in SSRS 2005 preview window just for giggles,
> >> returned
> >> true as expected.
> >> =IsNumeric("$1,0562.00")
> >>
> >> "Nathan" <Nathan@.discussions.microsoft.com> wrote in message
> >> news:4B24FE69-BCA8-48CF-8ECC-40F8FCCC5448@.microsoft.com...
> >> >I tried posting this earlier, but it never showed up. Hopefully I don't
> >> > double post.
> >> >
> >> > I was writing code for a custom dll earlier this morning where I ran
> >> > into
> >> > some strange behavior for the IsNumeric function.
> >> > IsNumeric("$1,0562.00") was returning false
> >> > I thought that maybe this behavior was being cause by one of the
> >> > "features"
> >> > of the IsNumeric function so I decided to do some more testing.
> >> > I created a web app on the same machine and ran the same code there
> >> > IsNumeric("$1,0562.00") was returning true with the web app.
> >> >
> >> > I delved a little deeper and decided to research just what all
> >> > IsNumeric
> >> > does to check for a numeric value. I didn't have to go far.
> >> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctisnumeric.asp
> >> > states
> >> > "It also returns True if Expression is a String that can be
> >> > successfully
> >> > converted to a Double"
> >> >
> >> > So I decided to test the following code in each environment.
> >> > ctype("$1,0562.00",double)
> >> > Sure enough within the web app it worked fine, but within a reporting
> >> > services custom dll it threw an exception.
> >> >
> >> > Both the instance of reporting services and the webapp are being run
> >> > and
> >> > compiled on the same machine. They are both running under the 1.1
> >> > framework.
> >> > It would make more sense to me that the code didn't behave the way I
> >> > thought
> >> > it should if it was consistently misbehaving. :-)
> >> > It's quite possible there is something I'm missing here, but I'm just
> >> > trying
> >> > to figure out the reason for the inconsistency.
> >> >
> >> > I'm running Reporting Services 2003 with sp2 installed.
> >> >
> >> > Anyone have any ideas?
> >> >
> >> > Thanks,
> >> >
> >> > Nathan
> >> >
> >>
> >>
> >>
>
>|||Sorry about that, I missed the whole point.
I added the following method to a custom assembly and referenced this in a
2005 report and used the preview window. I was going to try the same in VS
2003, but my 2.0 assembly doesn't appear that it will work with the 1.1
framework in 2003. My custom assembly is in C#, referenced the VB.Net dll
to get the IsNumeric function.
public bool NewsGroup_CtypeFromString()
{
return Microsoft.VisualBasic.Information.IsNumeric("$1,0562.00");
}
Expression:
=Code.loc.NewsGroup_CtypeFromString
Returns True
Steve MunLeeuw
"Nathan" <Nathan@.discussions.microsoft.com> wrote in message
news:AC81C8D6-6E64-4867-A15E-72C034F3F511@.microsoft.com...
> Putting the "ctype("$1,0562.00",double)" directly in the cell on a page
> seems
> to work fine. It seems to be when the code is run in a custom dll that
> the
> problem occurs.
> Can anyone else reproduce this?
> Thanks,
> -Nathan
> "Steve MunLeeuw" wrote:
>> I just entered it as an expression in a textbox and clicked the Preview
>> tab
>> in the Report Designer (VS IDE)
>>
>> "Nathan" <Nathan@.discussions.microsoft.com> wrote in message
>> news:E814C5A0-E41D-4261-8A37-7ECB30C98D68@.microsoft.com...
>> > Perhaps this was something that was fixed with 2005? Although I'm
>> > still
>> > not
>> > ruling out that I'm missing something. When you say in the preview
>> > window
>> > do
>> > you mean you used "ctype("$1,0562.00",double)" in the custom code
>> > window
>> > there? I'll have to give that a try and see if it has the same
>> > behavior
>> > as
>> > calling it within a custom dll.
>> > "Steve MunLeeuw" wrote:
>> >
>> >> That is odd. I tried in SSRS 2005 preview window just for giggles,
>> >> returned
>> >> true as expected.
>> >> =IsNumeric("$1,0562.00")
>> >>
>> >> "Nathan" <Nathan@.discussions.microsoft.com> wrote in message
>> >> news:4B24FE69-BCA8-48CF-8ECC-40F8FCCC5448@.microsoft.com...
>> >> >I tried posting this earlier, but it never showed up. Hopefully I
>> >> >don't
>> >> > double post.
>> >> >
>> >> > I was writing code for a custom dll earlier this morning where I ran
>> >> > into
>> >> > some strange behavior for the IsNumeric function.
>> >> > IsNumeric("$1,0562.00") was returning false
>> >> > I thought that maybe this behavior was being cause by one of the
>> >> > "features"
>> >> > of the IsNumeric function so I decided to do some more testing.
>> >> > I created a web app on the same machine and ran the same code there
>> >> > IsNumeric("$1,0562.00") was returning true with the web app.
>> >> >
>> >> > I delved a little deeper and decided to research just what all
>> >> > IsNumeric
>> >> > does to check for a numeric value. I didn't have to go far.
>> >> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctisnumeric.asp
>> >> > states
>> >> > "It also returns True if Expression is a String that can be
>> >> > successfully
>> >> > converted to a Double"
>> >> >
>> >> > So I decided to test the following code in each environment.
>> >> > ctype("$1,0562.00",double)
>> >> > Sure enough within the web app it worked fine, but within a
>> >> > reporting
>> >> > services custom dll it threw an exception.
>> >> >
>> >> > Both the instance of reporting services and the webapp are being run
>> >> > and
>> >> > compiled on the same machine. They are both running under the 1.1
>> >> > framework.
>> >> > It would make more sense to me that the code didn't behave the way I
>> >> > thought
>> >> > it should if it was consistently misbehaving. :-)
>> >> > It's quite possible there is something I'm missing here, but I'm
>> >> > just
>> >> > trying
>> >> > to figure out the reason for the inconsistency.
>> >> >
>> >> > I'm running Reporting Services 2003 with sp2 installed.
>> >> >
>> >> > Anyone have any ideas?
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Nathan
>> >> >
>> >>
>> >>
>> >>
>>|||Got off my lazy horse and tried in VS 2003, I don't have VB installed, I
think using regular expressions would defeat the whole purpose of your case.
Maybe using RegExpr instead of IsNumeric would be a valid workaround?
sorry, C#
deonvs said:
Even easier:
static bool IsNumeric(string inputString)
{
return Regex.IsMatch(inputString, "^[0-9]+$");
}
Reference: http://dotnet.org.za/deonvs/archive/2004/07/06/2579.aspx
Steve MunLeeuw
"Nathan" <Nathan@.discussions.microsoft.com> wrote in message
news:AC81C8D6-6E64-4867-A15E-72C034F3F511@.microsoft.com...
> Putting the "ctype("$1,0562.00",double)" directly in the cell on a page
> seems
> to work fine. It seems to be when the code is run in a custom dll that
> the
> problem occurs.
> Can anyone else reproduce this?
> Thanks,
> -Nathan
> "Steve MunLeeuw" wrote:
>> I just entered it as an expression in a textbox and clicked the Preview
>> tab
>> in the Report Designer (VS IDE)
>>
>> "Nathan" <Nathan@.discussions.microsoft.com> wrote in message
>> news:E814C5A0-E41D-4261-8A37-7ECB30C98D68@.microsoft.com...
>> > Perhaps this was something that was fixed with 2005? Although I'm
>> > still
>> > not
>> > ruling out that I'm missing something. When you say in the preview
>> > window
>> > do
>> > you mean you used "ctype("$1,0562.00",double)" in the custom code
>> > window
>> > there? I'll have to give that a try and see if it has the same
>> > behavior
>> > as
>> > calling it within a custom dll.
>> > "Steve MunLeeuw" wrote:
>> >
>> >> That is odd. I tried in SSRS 2005 preview window just for giggles,
>> >> returned
>> >> true as expected.
>> >> =IsNumeric("$1,0562.00")
>> >>
>> >> "Nathan" <Nathan@.discussions.microsoft.com> wrote in message
>> >> news:4B24FE69-BCA8-48CF-8ECC-40F8FCCC5448@.microsoft.com...
>> >> >I tried posting this earlier, but it never showed up. Hopefully I
>> >> >don't
>> >> > double post.
>> >> >
>> >> > I was writing code for a custom dll earlier this morning where I ran
>> >> > into
>> >> > some strange behavior for the IsNumeric function.
>> >> > IsNumeric("$1,0562.00") was returning false
>> >> > I thought that maybe this behavior was being cause by one of the
>> >> > "features"
>> >> > of the IsNumeric function so I decided to do some more testing.
>> >> > I created a web app on the same machine and ran the same code there
>> >> > IsNumeric("$1,0562.00") was returning true with the web app.
>> >> >
>> >> > I delved a little deeper and decided to research just what all
>> >> > IsNumeric
>> >> > does to check for a numeric value. I didn't have to go far.
>> >> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctisnumeric.asp
>> >> > states
>> >> > "It also returns True if Expression is a String that can be
>> >> > successfully
>> >> > converted to a Double"
>> >> >
>> >> > So I decided to test the following code in each environment.
>> >> > ctype("$1,0562.00",double)
>> >> > Sure enough within the web app it worked fine, but within a
>> >> > reporting
>> >> > services custom dll it threw an exception.
>> >> >
>> >> > Both the instance of reporting services and the webapp are being run
>> >> > and
>> >> > compiled on the same machine. They are both running under the 1.1
>> >> > framework.
>> >> > It would make more sense to me that the code didn't behave the way I
>> >> > thought
>> >> > it should if it was consistently misbehaving. :-)
>> >> > It's quite possible there is something I'm missing here, but I'm
>> >> > just
>> >> > trying
>> >> > to figure out the reason for the inconsistency.
>> >> >
>> >> > I'm running Reporting Services 2003 with sp2 installed.
>> >> >
>> >> > Anyone have any ideas?
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Nathan
>> >> >
>> >>
>> >>
>> >>
>>

Tuesday, February 14, 2012

CSS for ssrs

Hello Friends

Can i use a custom style sheet to and apply specific styles for the text fields / data displayed in the report ( with out destroying the build in / default provided by MS -- i am still a newbie)

if yes kindly explain or guide me to articles (i googled a bit but did not find much help)

regards

Sara

As I understand it, a css can be applied to the report viewer, but not the actual reports.|||

Dear dr_99 Thank you for your reply

I have large number of reports and each report has quite a number of fields to display...it is time consuming to apply font, size, color...etc for each field

Can some body help!!!!!

Regards

Sara