Before you do the “if statement” check your iteration.
Check to see if it is stepping through your iterate with just a simple copy regardless of the input field maybe with an echo in the tcl code.
If that works then I would agree with Tom, other wise you will need to look at your basis and you hl7 definitions.
But yes iterates do work and have saved me many times.