Add row value from a data flow to an object variable

  • 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
  • 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

  • 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
  • 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

  • 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
  • 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

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply