Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Add row value from a data flow to an object variable


Add row value from a data flow to an object variable

Author
Message
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 654
Hi,

I would like to add a column value in a data flow Task to an object variable using the script component.
Is there any Kind of append method to do this.

I have declared an object variable called Accounts. I´m getting results from a OLE DB Source component, and I would like to add the value of a specific column, let´s say Account_NR, to this variable. Something like: Accounts.Add(Account_NR).

is it possible?

Any comment would be appreciated.

Kind regards,

Paul Hernández
Elliott Whitlow
Elliott Whitlow
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6208 Visits: 5314
Let me see if I read that right..

1. You have a dataflow that you want to add some data to.
2. That data is being sourced from a Script Source.
3. You are looking for a wait to basically do a join between them.

Is that all correct?

CEWII
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 654
Hi Elliot,

thanks so much for your answer.

The situation is the following:
- I have an OLE DB source.
- Then I perform some lookups and splits
- I update some records using an OLE DB commmand
- Then I would like to store some values from a column (the id of the accounts that were updated in this case)

I though I can use a script component to store these values in a variable and then iterate the variable in other data flow task or using a for each loop.

At the moment I solved the problem in another way but I´m still curious and I would like to know if that could be made.

Kind Regards,

Paul Hernández
Elliott Whitlow
Elliott Whitlow
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6208 Visits: 5314
Paul Hernández (7/25/2013)
The situation is the following:
- I have an OLE DB source.
- Then I perform some lookups and splits
- I update some records using an OLE DB commmand
- Then I would like to store some values from a column (the id of the accounts that were updated in this case)

I though I can use a script component to store these values in a variable and then iterate the variable in other data flow task or using a for each loop.

At the moment I solved the problem in another way but I´m still curious and I would like to know if that could be made.

The OLE DB Command doesn't allow you to inject a returned value back into the pipeline. Probably the easiest to get that would be to do a lookup based on the where criteria you would have used in the OLE DB command to get the ID into the pipeline then use that ID as the WHERE criteria.

But as I reread what you want to do I am confused by the process, you have a set of actions that culminate in an OLE DB Command, why do you need the IDs and why do you need to iterate through them? I must be missing something.

CEWII
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 654
Hi Elliott,

thanks again for your answer.

The business case is the following.

I have a customer card system with partnership capabilities. A partnership can only have one main card and more partner cards.

The system is operating using a CRM system.

Every customer has its own card number and customer number, but a partnership has only one account. That means, every member of the partnership has its own card but all of the cards points to the same account.

My challenge: if the owner of the main card is deactivated (the deactivation is stored in the CRM database), I have to deactivate this customer in a staging db, and I also have to mark all of the partner cards as main cards and their owners as main participants.

I hope I have explained the situation and not created more confusion w00t

I select the contactId, cardId and accountId in the first query, then using an oledb command I update the customer status in the staging db using the Contact ID. I would like to store the accountIds in a variable in order to lookup the cards and customers (the partners) that points to these accounts and finally take the appropriated actions.

Kind Regards

Paul Hernández
Elliott Whitlow
Elliott Whitlow
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6208 Visits: 5314
Paul Hernández (7/26/2013)
Every customer has its own card number and customer number, but a partnership has only one account. That means, every member of the partnership has its own card but all of the cards points to the same account.

My challenge: if the owner of the main card is deactivated (the deactivation is stored in the CRM database), I have to deactivate this customer in a staging db, and I also have to mark all of the partner cards as main cards and their owners as main participants.

I hope I have explained the situation and not created more confusion w00t

I select the contactId, cardId and accountId in the first query, then using an oledb command I update the customer status in the staging db using the Contact ID. I would like to store the accountIds in a variable in order to lookup the cards and customers (the partners) that points to these accounts and finally take the appropriated actions.

That is much clearer.. What happens when the master is reactivated?

I am still unclear on part of it though, you should have the a table of the all the cards somewhere in the main system, why aren't you querying the entire list at one time? OR better yet, the sub accounts all should have a code that links back to the main, just update them based on that common value, you don't need to do them one at a time, you can do that easily with an OLE DB command.. We need to be doing set operations whenever possible and not hitting one record at a time..

CEWII
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search