Hi, i would like to edit this calculation formula with a conditional, if there is an empty value change it to another different value. If there is a consitional structure, i want to know its syntax to work with it.
Not sure if this is what you mean, I’m on my phone so this is not my best code but here are three examples:
const fullname = @Surname ? `${@First name} ${@Surname}` : `@First name`;
const ref = `PER${date_fns.format(@Created on, 'yy')}${String(@Unique ID).padStart(3, '0')}`;
`${ref} :: ${fullname}`
let fTitle = [
@Doc Type?.trim(),
@Doc Number?.trim(),
@Name?.trim()
].filter(Boolean).join(" -/- ");
fTitle;
const f = @First Name;
const s = @Surname;
const st = @Engagement Status.split(" ")[0];
const t = @Contact Type.split(" ")[0];
let fullName = "";
if (s == null || s == "") {
fullName = `${st}${t} ${f}`;
} else {
fullName = `${st}${t} ${f} ${s}`;
}