[Last answer deleted as I touched the ‘Enter’ key by mistake before done)
Copied from above. Quote style is likely a forum formatting issue rather than your code but muse be valid matched (and nested if necessary) pairs of single or double straight quotes. Doubles are the general norm unless enclosing code snippets using double straight quotes.
I notice none of the .format() strings are quoted, though I believe they should (must?) be.
I generally either close all export codes (i.e. ^ front and back). My understanding is if unclosed looks for the next ^ or the end of the line as it parses. I prefer lack of ambiguity even if template code is full of ^. At least you know where codes intentionally start and stop if you close them. Think of writing \<br> vs. \<br/> in HTML; in the former case you are assuming the browser correctly reads the former as intending the latter.
^if()^ export queries now use query (action)code, so I don’t believe export code is pertinent in a query: e.g. rather than:
Note that the equality operator is ‘==’ not ‘=’. Again, due to support for very loose syntax in early Tinderbox (when such code use was significantly less complex), Tinderbox may guess the correct outcome but it’s better if not. Rather than test == and put code only in the ‘else’ branch, use != if you only want to write for one branch. If nothing else it makes the code clearer/shorter. I your queries use $-prefixes, e.g. $OppReport!="No" not OppReport!="No".
If you are testing for app values, especially Booleans, you can use the short form, e.g. ^if($PCWhitelabel)^ instead of ^if($PCWhitelabel==true)^
If testing is a data attribute has a non-null (i.e. default) value, you don’t need to format it.
Below I’ve fixed all these issues plus broken out each attribute value call onto a new line for clarity, though I assume they are space (or tab?) delimited in your template. Unlike within action code, whitespace and line breaks outside code are literal in terms of export (even if only in source code as opposed to rendered form). So this is what I think you are trying to export (line breaks aside)