I have a column called source_title and I'm trying to run a simple IF statement on it to give a new value to empty fields. So the logic is, if the field is empty or "(blank)" then replace that field with "Unknown". My code is below:
if IsEmpty([Source_Title]) or [Source_Title] = "(blank)" then [Source_Title] = "Unknown" else [Source_Title] endif
The code outputs a 0 instead of "Unknown" for all of the empty fields, does anyone know why? The format of the field is V_String.
Solved! Go to Solution.
Hey @willd9, I recently wrote a blog on common Formula errors, one of which is this exact scenario! See section 4 here: https://community.alteryx.com/t5/Engine-Works/Troubleshooting-Common-Formula-Expression-Errors/ba-p/...
Essentially, you'll just want to remove the [Source_Title] = from your current expression so it should be:
if IsEmpty([Source_Title]) or [Source_Title] = "(blank)" then "Unknown" else [Source_Title] endif
@willd9 Another way of using this formula with the Trim function
IIF(IsEmpty(Trim([Source_Title])),’unknown’,[Source_Title])