Skip to main content
Solved

How to add a column from an csv file to the "To" section of the SendMail in workflow?

  • September 13, 2024
  • 5 replies
  • 141 views

Forum|alt.badge.img

We are trying to pass a csv file’s column which is generated from the Run DQC and contains a list of emails to the Send Mail’s “to” section. What are the other ways of passing a column to that particular section. Let me know if there are any alternative steps.
 

This is the workflow plan

Configuration of Send Mail:



Regards,
Emmanuel

Best answer by AKislyakov

Hi @EmmanuelF,

There are two ways to read external data to use it in a Workflow:

  • Read SQL Result (Read SQL Result :: Ataccama ONE) -- Reads data provided by a query to the variables defined by the mapping. You’ll need a database connection to query the data.
  • Read File Variables (Read File Variables :: Ataccama ONE) -- Read data from a file. Right now, the only supported file type is a property file (a text file holding properties defined as key-value pairs in a format property.key=property.value)

For your case I think the latter suits better. So you need to ensure that DQC plan outputs data in a supported (property) format. Then read it using Read File Variables step and then you can use results of the Send Mail step using ${ewfGetTaskVariable("read_file_vars_task_name", "key")} syntax (more on the ewfGetTaskVariable function)

5 replies

Forum|alt.badge.img+2
  • Ataccamer
  • Answer
  • September 13, 2024

Hi @EmmanuelF,

There are two ways to read external data to use it in a Workflow:

  • Read SQL Result (Read SQL Result :: Ataccama ONE) -- Reads data provided by a query to the variables defined by the mapping. You’ll need a database connection to query the data.
  • Read File Variables (Read File Variables :: Ataccama ONE) -- Read data from a file. Right now, the only supported file type is a property file (a text file holding properties defined as key-value pairs in a format property.key=property.value)

For your case I think the latter suits better. So you need to ensure that DQC plan outputs data in a supported (property) format. Then read it using Read File Variables step and then you can use results of the Send Mail step using ${ewfGetTaskVariable("read_file_vars_task_name", "key")} syntax (more on the ewfGetTaskVariable function)


Forum|alt.badge.img
  • Author
  • Universe Traveller
  • September 13, 2024

Hi @EmmanuelF,

There are two ways to read external data to use it in a Workflow:

  • Read SQL Result (Read SQL Result :: Ataccama ONE) -- Reads data provided by a query to the variables defined by the mapping. You’ll need a database connection to query the data.
  • Read File Variables (Read File Variables :: Ataccama ONE) -- Read data from a file. Right now, the only supported file type is a property file (a text file holding properties defined as key-value pairs in a format property.key=property.value)

For your case I think the latter suits better. So you need to ensure that DQC plan outputs data in a supported (property) format. Then read it using Read File Variables step and then you can use results of the Send Mail step using ${ewfGetTaskVariable("read_file_vars_task_name", "key")} syntax (more on the ewfGetTaskVariable function)

 

Hi @AKislyakov,
I have created the properties file and have passed it to the Read File Variable as below

 

Now when I pass this variable to the Send Mail as such

I get an error stating “Illegal address in string ``abc@xyz.com,efg@xyz.com''”
If the email contains only a single email id the mail is sent. How do I include multiple email ids?


Forum|alt.badge.img+2
  • Ataccamer
  • September 13, 2024

To send email to multiple recipients email addresses should be separated by \r\n separator.


Forum|alt.badge.img
  • Author
  • Universe Traveller
  • September 13, 2024

To send email to multiple recipients email addresses should be separated by \r\n separator.

Manually it is possible to separate emails with this separator. What if I need to write a list of emails (These emails are fetched in the Run DQC Plan) with this separator in a .properties file using a text file writer?


Forum|alt.badge.img
  • Author
  • Universe Traveller
  • September 13, 2024

I found the solution, Thanks for your help.