Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Add row value from a data flow to an object variable Expand / Collapse
Author
Message
Posted Wednesday, July 24, 2013 3:22 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 6:51 AM
Points: 120, Visits: 490
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
http://hernandezpaul.wordpress.com/
https://twitter.com/paul_eng
Post #1476937
Posted Wednesday, July 24, 2013 9:04 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, October 9, 2014 1:02 PM
Points: 6,032, Visits: 5,284
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
Post #1477120
Posted Thursday, July 25, 2013 4:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 6:51 AM
Points: 120, Visits: 490
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
http://hernandezpaul.wordpress.com/
https://twitter.com/paul_eng
Post #1477431
Posted Thursday, July 25, 2013 10:14 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, October 9, 2014 1:02 PM
Points: 6,032, Visits: 5,284
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
Post #1477607
Posted Friday, July 26, 2013 3:34 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 6:51 AM
Points: 120, Visits: 490
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

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
http://hernandezpaul.wordpress.com/
https://twitter.com/paul_eng
Post #1477919
Posted Friday, July 26, 2013 1:32 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, October 9, 2014 1:02 PM
Points: 6,032, Visits: 5,284
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

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
Post #1478177
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse