Skip to main content

Hi,

 

I have a process that im unable to get working and wold like advice on the processes

I have a dataset containing a number of records, each with a user and their email address. There are multiple records for each user,

The requirement is to identify each unique user in the data and send them an email detailing all the records relating to them. The users could change each time the process is run so i havent set any filters with their names.

My thoughts were to create a loop to go through a list of users, filtering their records out and sending the email before moving onto the next name on the list.

This would keep going round until there are no names left in the list.

I have used the statistic calculator to identify the users and have used the HTML report generator and emailer for the the end of the process but would like some help explaining how the loop should be set up (if this is the best way to do it) and how i can move to the next person in the list each time.

 

Thanks

You don’t ‘loop over’ data in FME.

Say your data is something like:
 

Name Email Type
Hamish hamish@fme a
Adam adam@fme b
Adam adam@fme a
Hamish hamish@fme c
Zipster zipster@fme b

 

 

When passing this through the statistics calculator, make use of the Group By function
https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Transformers/Group_Based_Transformers.htm

 

This will then mean it only compares features with the same value in the specified field(s)

 

If you used the ‘Name’ Field, your output would then be something like

 

Name Email count
Hamish hamish@fme 2
Adam adam@fme 2
Zipster zipster@fme 1

 

These can then be used be the report generator and emailer to create/send your emails

 


Thanks for the response, i have the unique list of emails that can be sent through to the emailer but what i need is for a second list of data to be filtered and provided in the email.

 

For example using your table above:

List A  = Summary list of email addresses - Statistics calculator

Name Email count
Hamish hamish@fme 2
Adam adam@fme 2
Zipster zipster@fme 1

 

List B = Individual records containing the email address attribute

Email Ref Location Type
hamish@fme 20039 Surrey Type 1
adam@fme 20040 Hampshire Type 2
zipster@fme 20041 Hampshire Type 3
hamish@fme 20042 Kent Type 1
hamish@fme 20043 Surrey Type 1
adam@fme 20044 Kent Type 1
zipster@fme 20045 Surrey Type 2

I need the process to look at the email address in List A and then send an email to each address containing a table of data made of only records in list B relating to the specified email address. 

Output table for 1st email would be to hamish@fme with the following HTML content:

Email Ref Location Type
hamish@fme 20039 Surrey Type 1
hamish@fme 20042 Kent Type 1
hamish@fme 20043 Surrey Type 1

This would be repeated for each of the email addresses in List A until no more email addresses are available.

I have the HTML report created but need to understand the flow of how this would work.

Any help would be appreciated.

 


I think you need to do a join on the data. Probably join tables A and B using email address as the key.

Try the FeatureJoiner transformer first. It should create an output feature per match.

Alternatively, many people find the FeatureMerger to be simpler. You would create a list with that transformer and then use the ListExploder to create a feature per match.

With that, you should have a feature per email to be sent.


Reply