The simpler expression is working, but the one in the forumdisplay thread template is not. I tested by deactivating XThreads and then using the simpler expression you provided in the header. I got the output blah.
This is my code from the forumdisplay_thread, all threadfields values at 4:
The output is:
4 (correct)
12 (correct)
123 - NOT correct
blank
I am not sure how to use globals instead, but as the example from the first post in the Template Conditionals download failed then I am stumped. I am using XThreads custom fields in a prefixed template.
I tested this expression 123<?=substr("987654321", 3)?> in the header - and it returned 123.