Read up on the use of the FIELD keyword. It doesn’t do what you think it does. Take it out of the entire formula.
Also, I am not sure about if this is doing what you want “Trim(Cdat(doc.DeleteStartDate(0)))”. You can test that by creating variables for testing and seeing what each part of this does – for instance, is doc.deletestartdate(0) a string that can be converted to date-time with Cdat? What does Trim take out of the converted date? If there is extraneous text that needs to be removed from doc.deletestartdate(0), it seems Trim should be applied inside of Cdat. Lots going on there that needs to be looked at, I would think.
Before using a formula in a script, test it as a view formula. When you have a view formula that work, convert it for use in the script, subsituting variables as needed, as you are doing in this instance.