StudioX Email Table

I have a last minute request to build an automation in StudioX for multiple emails:

Example:

NEW Comp Grade New Comp Grade Profile District Store Email Address Manager Manager Email
12 12-USA Standard USA 1 Albertville joe joejoe
15 15-USA 1 USA1 Albertville joe joejoe
12 12-USA Standard USA2 Arundel arundel arundel1
12 12-USA Standard USA3 Wawa wawa wawa2
12 12-USA Standard USA4 7-Eleven you me
18 18-USA 18 USA4 7-Eleven you me

Multiple emails with different data to send in a single email. I don’t want to send an email for every line. This is urgent. Please HELP!!

Hello @tiffany.paquette,

Follow these steps:-

  1. Use Excel File → point to your data file.
  2. For Each Excel Row Group → Group by Email Address.
  3. Inside the group:
    a. Create Data Table → for the email content.
    b. For Each Excel Row in Current Group → Add Data Row to this table.
  4. Send Email:
    a. To: CurrentGroupName
    b. Body: insert the table.

You can try this approach

Use Excel File → For Each (group by Manager Email) → Assign EmailBody = "" → For Each Excel Row in CurrentGroup → Assign EmailBody = EmailBody + "Comp Grade: " + CurrentRow.ByField("NEW Comp Grade").ToString + ", Profile: " + CurrentRow.ByField("New Comp Grade Profile").ToString + ", Store: " + CurrentRow.ByField("Store").ToString + Environment.NewLine → End For Each Row → Send Email (To = CurrentGroup(“Manager Email”), Body = "Hi " + CurrentGroup(“Manager”) + “,” + Environment.NewLine + EmailBody) → End For Each Group.

Cheers

dtA = dtA.AsEnumerable.Concat(dtB.AsEnumerable).CopyToDataTable()

Hey,

First get all unique email addresses into an array. You can find example linq below

emailArray = dt.AsEnumerable().
Select(Function(r) r(“Email Address”).ToString).
Distinct().
ToArray()

Then for each array element, filter your datatable by CurrentItem and get your grouped datatable