I'm working on creating a maintenance job within SSIS and one of the steps requires me to read from a variable, check a value, and if that value is within a specific range, write that row to a new object for processing in a following step. I have the majority of the script written, but I can't quite put together how to write values to an object from within a script task.
Here's what I have now:

To quickly run through this, it grabs all database names from the server then runs a database integrity check. Following that it pulls up a list of all databases and their last known good integrity check. The final ForEach Loop is where I'm experiencing issues. I want it to take the object from the previous SQL task, read the variables, and if the last known good date is near the current time, feed it into a new object for use in a coming step to back that database up.
Execute SQL Taskis going to be measured against current time, why not just do the logic in the query and only return the databases you care about. This greatly simplifies the logic and maintainability of what you are trying to do.