Tinderbox Forum

Help with export code

Hi there, I’m having some trouble with export code. My HTML template is as follows:


^value($Organization)^ ^value($OppType)^ ^value($OppStage)^ ^if(^value($OppDeliveryDate.format(l))="never")^else^^value($OppDeliveryDate.format(l))^endif^ ^if(^value($PCWhitelabel)^=true)Yes^endif^ ^if(^value($PCAliasManager)^=true)Yes^endif^ ^if(^value($PCAliasAPISDK)^=true)Yes^endif^ ^if(^value($PCPasswordManager)^=true)Yes^endif^ ^if(^value($PCTrackerManager)^=true)Yes^endif^ ^if(^value($PCDataManager)^=true)Yes^endif^ ^if(^value($PCHelpCenter)^=true)Yes^endif^ ^value($OppDependency)^ ^value($PCNote)^ ^children(/Templates/PCConfigExport page/HTML item) ^endIf^

This line is causing me a problem:


My output looks like this:

For some reason, I can’t get the else statement to display the date.

NOTE: It works find without the condition.



and you are missing the main predicate (the default if true action) in


Ok, I fixed the first issue by changing the attribute type:


As for the second, no joy. Same issue. Also, I want the cell to be blank if true.

I got it to work but I’m not sure why. The only way to make it work is to NOT include ^else^

As always, thanks!

[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)

   ^children(/Templates/PCConfigExport page/HTML item)^

More on the short-form test for attribute values.

Does that help?

I might add that I assumed $OppReport is not a Boolean type attribute.

He Mark, initially it was NOT a boolean, but I’ve since changed it.

1 Like

Cool, thanks. I’ve updated the syntax to be correct, works great.

1 Like