You can use the ternary syntax (The expression verifier in Simple Object Designer doesn’t understand it, but done currently, it will work on BC25+)
https://learn.microsoft.com/en-us/dynamics365/release-plan/2024wave2/smb/dynamics365-business-central/use-ternary-operator-when-coding-al-language
Something like:
a= ‘XYV ? 0 : Rec.”Cost Amount”
Thank you! I will give that a try!