Thanks so much for the responses guys. I'm a little embarrassed to say I found the problem.
In my attempt to make the problem easier to understand I cut down the code so much that my problem doesn't show here.
So here goes.
My full code is designed to export a list of fields from documents in a collection.
Some of the fields required a formula to calculate which field to export. That’s why I used evaluate.
I have a config doc that allows me to create a configurable list of fields to export. I pass the list as an array, and silly me didn’t make the connection that a space would be seen as a separator in my array.
So when the evaluate ran on this formula:
@If(Status='Awaiting Approval';Approver;"")
It was failing because it was actually running on this formula
@If(Status='Awaiting
So now I have fixed the handling of my array and it works, just like it should.
So I’m very sorry for wasting your time and I thank you very much.
PS David I’m a huge fan, you have taught me so much with your notes@9 videos.