0

I have a for-each loop that goes through a file directory. These files are transaction information from different clients. When there is an error with a file (i.e. can't be processed), the Event Handler is to send an email to the client notifying them. There is a SQL task that uses an existing variable (Client ID from the file) that queries a table to get the Client's email address. I created a variable for the Client Email. I want to make this update each time the for-each loop is run, since each file will have a different value for the client email variable.

How can I ensure this?

Inside the for-each loop, there are three data flow tasks that could conceivably "error" and that's when I will be sending these notification emails. Will I need to scope a variable for each of the three executables within the loop for the Client Email? Or can I scope a single variable in the for-each loop?

I understand this may be a bit confusing so please let me know if you have any questions.

Event Handler Flow

For-Each loop with data flow task

J. Mini
1,3101 gold badge9 silver badges33 bronze badges
asked Jul 17, 2020 at 14:44

1 Answer 1

0

You can create the variable either at the foreach loop container or at the global scope, by making sure that the foreach container is selected when you create the variable, or nothing is selected when you create the variable.

Inside the foreach loop container you can then add an Expression Task in order to change the value of the variable at run time.

Depending on what you need exactly, you could also use a Script Task for this purpose.

There's a similar question here with the relevant details:

https://stackoverflow.com/questions/4052864/ssis-set-variable-at-runtime

answered Jul 17, 2020 at 16:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.