Loop dataset goes though the same row over and over instead of moving on

Hi, I’m working with a PostgresSQL db connection, with a table that contains transactions pertaining to several clients.

I want to make a query to this table and then have that query exported to an excel file once per client name on the table.

For this I want to use the Loop Dataset activity.

This is the Query I wrote on the Activity info:

SELECT DISTINCT "Account_Name"

FROM "accounts"

This gets me a unique list of all the account names, which is the list I intend to go though.

Then I took a select to File activity and placed it inside the loop data set one

This is the SQL I wrote inside the select to File activity input

select "Account_Name" , "Account_SID" , "Inst_Name"

from accounts

WHERE(accounts. "Account_Name" = :Loop_data_1_SQL. Account_Name )

And the name of the file in the export I wrote it as #Loop_data_1_SQL#.xlsx, trying to get one file per name, I also uncheck the “overwrite” checkmark at the export to file section.

But when I ran the script only one file got created, with only the values of the first account name, and in the log it appears as if the loop went over the same row over and over.

image

What am I doing wrong?

Please add your full script for us to view.

its not letting me upload the script file but i hope the new images help:


e