I need little help with a database select using for each function please

I have a input file I read through using for each. Then for each row in the file I have to run a select. The data table created in the select only stores result of the last row.
Please let me know how to avoid the data table in the select activity from being over written.

Are you creating/initializing the data table before you enter the For Each (your scope matters)?
Then in the For Each each you would append your records.
At end of For Each within the same scope of creating/initializing the data table you should then have all records.

Hi ,
Thank you for checking this.
a) Currently I am initiating the data table with in the For Each. The reason being
The Select activity in CassandraDB Scope activity did not provide a way to use existing session. So to avoid connecting to database for each record I tried to implement it with one connection in Scope and a For Each with in it.
b) I will try your suggestion if I can initiate data table before the “For Each”.

Hi GenXDo,
Thank you for your suggestion. I updated my workflow and initiated the data table outside the Cassandra scope. Then used merge data table function. This gave me the desired out put.
Please let me know if I have to do step to close this topic.

Thank you.

That’s great Mks, glad you got it working. If you could, in the response that included the solution you should have a green checkmark in the bottom list set of options that will mark it as Solved. Here is more details in How to ask a good question?
Thanks, GenXDo

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.