I have two input files from the same source, saved in the download folder, with different file names but the same format. I want the workflow to continue even if one of the inputs is empty. After processing the inputs, a table and report text and layout tool will follow. I'll send you a screenshot.
The goal is to include both tables in a single email. The email should say: "Hi, please add the following to the primary data and the following to the secondary data." If the secondary input file is missing, the email should still be sent without errors, only showing: "Hi, please add the following to the primary data," and vice versa. Is this achievable?
Hi, @Gurinder27
Anyway, does your email want to contain any attachments? If so, how many attachments are there in each of the two cases?
No attachments
only body of the email with tables or table
Hi, @Gurinder27
Since you did not provide a screenshot of the expected output email template, I can only briefly explain the key points of the process.
1- Merge data sources.
Due to the possibility that one of the two data files you need to input may be missing, you need to use the FileExists (Path) function to check if the file exists and use a batch macro to input the existing file data. I am not sure if the file may not exist in the scenario you described, or if it exists but its data may only have a title without any records, so it cannot be expanded.
2- Create email body.
Please watch the animation of the workflow. The most crucial part here is the CrossTab+Formula tools, which combines to generate dynamic email body. The judging condition is the number of your records, and then the Union tool is used to create a complete body in String+Table format.
3- Send email.
This step does not require any skills, you can operate according to your own settings.
BTW, Due to security policy restrictions, I am unable to upload any workflow files, so please watch the animation.
'Hi, please ' +
(IF [Primary_Data]!= 0 && [Secondary_Data]!= 0
THEN 'add the following to the primary data and the following to the secondary data.'
ELSEIF [Primary_Data]!= 0 && [Secondary_Data]= 0
THEN 'add the following to the primary data.'
ELSEIF [Primary_Data]= 0 && [Secondary_Data] != 0
THEN 'add the following to the secondary data.'
ELSE 'check if the 2 input files are valid.'
ENDIF) +
'<br /><br />'
If the second input file doesn't have data.
Thanks for the help and i will attempt it and share the feedback