Toad World® Forums

Looping and sending email blast

I’m trying to split dataset onto individual tabs and send each tab to it’s appropriate email group . Need a little assistance. I can split onto different tabs but using name variables not recognizing for sheeT names also.

Can you share your logic/flow of steps?

If using the same base dataset, I had one customer do something similar, only he read a flat file that contained the WHERE clause and corresponding e-mail address for each "slice" of the data, and then within the loop, for each WHERE clause, he would execute the base query with that particular WHERE, produce the CSV, zip it, and then mail to the corresponding address.

Sent screenshot of flow.

dataset variable name: RegionsDataset_SQL
export to file name: location\Report_#RegionsDataset_SQL#.xlsx (not working)

  • relative path cannot be calculated if the absolute path contains a variable.

Notes: I was under assumption that each exported result will go into its on excel file and not on new individual sheet in workbook. but this is ok as long as I can email based of sheet names. I just need to best way to do this.

This is just a select statement on Unique values of a table. Unique Regions

  1. Loop_row_1 / File_1
    This is just a query that loops through the dataset and exports each regions data onto separate tabs. ex.
    WHERE (TABLE2.TIN = :RegionsDataset_SQL.TIN)

  2. When exporting results the tabs only display sheet# . I need the name variable name as tab name.

  3. Next step I need to email to individuals based on each sheet .

thanks Gary for reaching out. after playing around with some more. I was able to figure out how to send emails and rename sheets by respective group.