Is it possible to configure an attachment to an email based on a condition?

I'm hoping to attach a pdf based on whether records are available in the file (not empty).

I've tried an IF/THEN  that checks whether records exist for a file and if yes, I provide the name of the file to attach but the THEN part is tricky as I'd want the expression to "do nothing" if the amount is not greater than 0 but the field is seeking an attachment name What type of expression can I use in the Attachment field for this functionality.

Thanks so much

Daisy_Ramirez_1-1656968952401.png

 

 

Daisy_Ramirez_2-1656968965072.png

 

Daisy_Ramirez_0-1656968810852.png

 

Solved Solved
0 9 126
1 ACCEPTED SOLUTION

Try replacing TRUE in your expression with an empty string ""

View solution in original post

9 REPLIES 9

Try replacing TRUE in your expression with an empty string ""

Otherwise change expression to IFS instead of IF, by removing your third argument of TRUE.

 

@Koichi_Tsuji I've seen problems with IFS() expressions lacking a default statement. 

@Joseph_Seddik I've never had any issues (with the fall-back for the IFS()); it's always blank - technically null, not even blank.

As long as you know it's null, and program appropriately for that, I've never had any issues.

@MultiTech Hello Matt!

If you are sure one of the IFS() statements will always match, then it's OK to omit that part. Otherwise, you should accommodate for the no-match case.

I always tail my IFS() with a (TRUE, whatever) statement. First time I did this was due to a bot or action (can't remember well) just stopping, without the slightest indication in the monitor about the reason. I identified it by updating a dummy column with "step1", "step2" etc. 

Then I remember replying to a post here where the app was crashing/stopped responding following the application of IFS() in a Security Filter. I suggested adding a no-match case (TRUE, whatever) and this solved the problem.

Later I've also seen a reply from @Steve to a problem of an app crashing in a Form view, and he was asking the user whether he has an IFS() lacking a no-match case. 

To the best of my recollection, there are a (very) few cases I've found where an IFS() expression that falls through without an explicit return would cause the expression to crash. IIRC, the cases involved ORDERBY() or EXTRACT...(). In the cases I found, I reported the behavior, and it's possible they've been fixed.

Thank you!

@Daisy_Ramirez I'm curious to know if this worked or not?

I would think if you defaulted one of those attachment strings to blank, nothing would happen.

Then again I can entirely see the system trying to generate a blank document too... ๐Ÿ˜’ 

So I'm curious to see how things worked out for you.

It worked! Thanks so much Joseph and everyone. Here is the final expression: 

Daisy_Ramirez_0-1657036473588.png

 

Top Labels in this Space