And it cleaned up my code and expanded it to 5 fields and the resulting code might not even be correct, but what I'm getting at is that it is going to be complicated to picture, fairly menial to create (without AI), require thorough testing, and it will be really difficult to maintain.
IF(
ISBLANK({DE:field1}),
IF(
ISBLANK({DE:field2}),
IF(
ISBLANK({DE:field3}),
IF(
ISBLANK({DE:field4}),
IF(
ISBLANK({DE:field5}),
"",
{DE:field5}
),
CONCAT({DE:field3}, IF(ISBLANK({DE:field5}), "", CONCAT(",", {DE:field5})))
),
CONCAT({DE:field4}, IF(ISBLANK({DE:field5}), "", CONCAT(",", {DE:field5})))
),
CONCAT(
{DE:field2},
IF(ISBLANK({DE:field3}), "", CONCAT(",", {DE:field3})),
IF(ISBLANK({DE:field4}), "", CONCAT(",", {DE:field4})),
IF(ISBLANK({DE:field5}), "", CONCAT(",", {DE:field5}))
)
),
CONCAT(
{DE:field1},
IF(ISBLANK({DE:field2}), "", CONCAT(",", {DE:field2})),
IF(ISBLANK({DE:field3}), "", CONCAT(",", {DE:field3})),
IF(ISBLANK({DE:field4}), "", CONCAT(",", {DE:field4})),
IF(ISBLANK({DE:field5}), "", CONCAT(",", {DE:field5}))
)
)
ISBLANK({DE:field1}),
IF(
ISBLANK({DE:field2}),
IF(
ISBLANK({DE:field3}),
IF(
ISBLANK({DE:field4}),
IF(
ISBLANK({DE:field5}),
"",
{DE:field5}
),
CONCAT({DE:field3}, IF(ISBLANK({DE:field5}), "", CONCAT(",", {DE:field5})))
),
CONCAT({DE:field4}, IF(ISBLANK({DE:field5}), "", CONCAT(",", {DE:field5})))
),
CONCAT(
{DE:field2},
IF(ISBLANK({DE:field3}), "", CONCAT(",", {DE:field3})),
IF(ISBLANK({DE:field4}), "", CONCAT(",", {DE:field4})),
IF(ISBLANK({DE:field5}), "", CONCAT(",", {DE:field5}))
)
),
CONCAT(
{DE:field1},
IF(ISBLANK({DE:field2}), "", CONCAT(",", {DE:field2})),
IF(ISBLANK({DE:field3}), "", CONCAT(",", {DE:field3})),
IF(ISBLANK({DE:field4}), "", CONCAT(",", {DE:field4})),
IF(ISBLANK({DE:field5}), "", CONCAT(",", {DE:field5}))
)
)
Breakdown of the AI logic:
Outer Logic: The outer IF checks if {DE:field1} is blank.
Nested Logic: Each nested IF checks the subsequent fields, building up the concatenation step by step. If a field is not blank, it’s added to the final output with a preceding comma if needed.
Concatenation: For each field, we check if it is blank before concatenating it to ensure proper formatting.
Outer Logic: The outer IF checks if {DE:field1} is blank.
Nested Logic: Each nested IF checks the subsequent fields, building up the concatenation step by step. If a field is not blank, it’s added to the final output with a preceding comma if needed.
Concatenation: For each field, we check if it is blank before concatenating it to ensure proper formatting.