I’d like to use a ternary operator inside a merge column, like in the attached example. If the conditional expression is false, then I’d like Clay to move on to evaluate the following column. I’ve tried passing in '' (as in the attached screenshot), false , null, and undefined as the fallback value to get Clay to move on to the next column, but it won’t. Is there a value I can replace '' in the screenshot with in order to get Clay to move on to evaluating the next column?
Hey hey! Can you drop the URL for your table here? (if applicable) 🫶 Don't worry, only admins will be able to open your table 😉
I’ve found a less elegant workaround for it so no table, but would like to know for future reference
Hey Joe! To merge with a more complex logic like this, I usually recommend just using a standard formula column to write the logic in one single go. Can totally see why this would help because you're breaking it down into sections, but I think it should also work here if given the command
so instead of ending with: : ''
I would write it like this ->
: (If X=1 ? Y : ...)
Thanks Arturo - to clarify, are you saying use : … instead of : ''
like an ellipsis?
Ohh, sorry, not the ellipsis itself but to reference continuation of the formula to address the following logic until you reach the final output, ending the entire formula in : ''
A proper example of the logic:{{col1}} ? {{x}} : ({{col2}} = 1 ? {{y}} : (!{{col3}} ? {{z}} :''))
basically a bunch of "if -> then" statements nested in a single argument until the end is closed with "empty"
Right yeah, I’ve been doing nested ternaries, but to clarify, my question here in more generalized terms is… What is the fallback value I need to put in for a Merge column in Clay in order for Clay to move on to the next column? What is the backend logic Clay uses to move from one column to the next in a Merged column and can it be replicated by a user by using a formula?
Well, based on how our email waterfalls are set up, it should work because it resembles this
So, curious if you may have a space in any of those columns that would consider it a character and hard to catch, thus not checking the next column?
Hmm
I don’t think so. I tried inserting a random string inside the '' like this 'test' and the column value would switch to 'test'
But that’s a good point about your waterfall setup. I’ll try it again knowing that a blank string should move the execution to the following column
Yep! Let me know if you need an extra eye to spot any potential issues here. The only other thing that comes to mind is stale data, something not running yet, and why it's on "standby" until everything has run for it to evaluate.
No worries! will keep an eye out if you ever run into this again :D