Solved

Emailing from a List


Hello there,

I am trying to set up a workbench that will send automated emails via fme server.

We "publish" data daily and I am looking to create a script that will basically read from a database (that has details of publishing) and send emails to a recipient depending on the destination (folder) where the dataset had been published.

The issue is sometimes multiple datasets are published to the same location. I don't want a separate email for all of them. If there are 10 datasets published to one folder, I want one email sent detailing the 10 datasets.

Here is what I have set up for the workbench. The top part (outside of the red box) sends email by reading from SQL with some modifications along the way. The information in the email is a combination of the following attributes DATRECORD, FILENAME and DIRECTORY. In the example below, 91 emails were sent.

I want only 15 emails send based on the grouping by the DIRECTORY attribute with the same information (all the DATERECORD and FILENAME info intact).

Any help would be appreciated. Thank you!

icon

Best answer by ciarab 14 August 2017, 20:45

View original

11 replies

Userlevel 4
Badge +30

Hi @fariyafarhad,

Try to use the transformer Sampler before the thransformer FMEServerEmailGenerator_2 in your Workspace.

I believe is good.

Userlevel 4
Badge +13

Hi @fariyafarhad,

Try to use the transformer Sampler before the thransformer FMEServerEmailGenerator_2 in your Workspace.

I believe is good.

Great suggestion. You can sample the first feature for each different 'DIRECTORY' using the following setup:

Hi @fariyafarhad,

Try to use the transformer Sampler before the thransformer FMEServerEmailGenerator_2 in your Workspace.

I believe is good.

Hi @danilo_inovacao

 

Can you please elaborate a bit more? How can a Sampler help in this situation? I set it grouping by DIRECTORY with N as 1. All features go through

 

Badge +9

you could use the htmlreportgenerator and group by option on the directory attribute. Then create a table in the html report generator of the information you are trying to display. The output will be an attribute _html you can use this in the body of the email in the fme server email generator. You should have one email per directory then listing the info in a table

Great suggestion. You can sample the first feature for each different 'DIRECTORY' using the following setup:

Hi @MattAtSafe

 

Sorry I don't think I was clear in my description. I need to send one email per grouping. That is achieved by the Sampler. But I need to list all the information within a group in one email. Not just the first.

 

you could use the htmlreportgenerator and group by option on the directory attribute. Then create a table in the html report generator of the information you are trying to display. The output will be an attribute _html you can use this in the body of the email in the fme server email generator. You should have one email per directory then listing the info in a table

Hello @ciarab, thanks for the suggestion. I saw a similar response for this question

 

https://knowledge.safe.com/questions/36111/best-way-to-insert-content-of-a-list-into-an-email.html

 

Unfortunately I am using 2016.0 and it doesn't seem to have that transformer.

 

Badge +9

you could use the htmlreportgenerator and group by option on the directory attribute. Then create a table in the html report generator of the information you are trying to display. The output will be an attribute _html you can use this in the body of the email in the fme server email generator. You should have one email per directory then listing the info in a table

 

That looks like the best option @fariyafarhad , are you not happy with the output??

 

That looks like the best option @fariyafarhad , are you not happy with the output??
@ciarab and @danilo_inovacao

 

Right now I have two list attributes (DATERECORD and FILENAME). I need this:

 

 

"_list{0}.DATERECORD" : "_list{0}.FILENAME"

 

"_list{1}.DATERECORD" : "_list{1}.FILENAME"

 

"_list{2}.DATERECORD" : "_list{2}.FILENAME"

 

 

one after another. The number of list elements within a group are unknown or dynamically generated. If I use listconcatenator, I cannot simply output something like this:

 

 

"DATERECORD_concatenated" : "FILENAME_concatenated"

 

The first one is a list of dates....

 

 

The date and time is important for the dataset publishing. So it's not an error but I am unable to produce the results I need with this

 

Badge +9
@ciarab and @danilo_inovacao

 

Right now I have two list attributes (DATERECORD and FILENAME). I need this:

 

 

"_list{0}.DATERECORD" : "_list{0}.FILENAME"

 

"_list{1}.DATERECORD" : "_list{1}.FILENAME"

 

"_list{2}.DATERECORD" : "_list{2}.FILENAME"

 

 

one after another. The number of list elements within a group are unknown or dynamically generated. If I use listconcatenator, I cannot simply output something like this:

 

 

"DATERECORD_concatenated" : "FILENAME_concatenated"

 

The first one is a list of dates....

 

 

The date and time is important for the dataset publishing. So it's not an error but I am unable to produce the results I need with this

 

@fariyafarhad If you create the information first in an attribute creator would that solve the issue? This way you have one concatenated list rather than trying to merge a number of them. Not sure if this is the solution to your problem but this is what I came up with in a sample

 

The output looks like this- see my sample .fmw hope you can open it okay its created in 2016.1

 

 

 

sample.fmw

 

@fariyafarhad If you create the information first in an attribute creator would that solve the issue? This way you have one concatenated list rather than trying to merge a number of them. Not sure if this is the solution to your problem but this is what I came up with in a sample

 

The output looks like this- see my sample .fmw hope you can open it okay its created in 2016.1

 

 

 

sample.fmw

 

@ciarab Thanks so much for your suggestion! That works perfectly for me. It didn't occur to me at all to create an attribute first. Thanks again!

 

Badge +9
@fariyafarhad If you create the information first in an attribute creator would that solve the issue? This way you have one concatenated list rather than trying to merge a number of them. Not sure if this is the solution to your problem but this is what I came up with in a sample

 

The output looks like this- see my sample .fmw hope you can open it okay its created in 2016.1

 

 

 

sample.fmw

 

No problem @fariyafarhad, we got there in the end!

 

Reply