Forum Discussion

Claudius's avatar
13 years ago

When boolean simply isn't true

I want to try if a board has a realized Tribal Knowledge Base attached to it using this freemarker code (second line is debug output):

<#assign tkb_present = rest("/boards/id/${coreNode.id}/tkb/realized").value />
tkb_present has the value "${tkb_present}".
<#if tkb_present>

The debug line puts out:

tkb_present has the value "true". 

But the if condition ist failing with a NonBooleanException:

Expecting a boolean (true/false) expression here
Expression tkb_present does not evaluate to true/false 
it is an instance of freemarker.ext.dom.ElementModel

I tried to cast the type by appending "?boolean" but that's no Freemarker Built-in :(

 

What am I missing here? 


  • Claudius wrote:

    I want to try if a board has a realized Tribal Knowledge Base attached to it using this freemarker code (second line is debug output):

    <#assign tkb_present = rest("/boards/id/${coreNode.id}/tkb/realized").value />
    tkb_present has the value "${tkb_present}".
    <#if tkb_present>

    The debug line puts out:

    tkb_present has the value "true". 

    But the if condition ist failing with a NonBooleanException:

    Expecting a boolean (true/false) expression here
    Expression tkb_present does not evaluate to true/false 
    it is an instance of freemarker.ext.dom.ElementModel

    I tried to cast the type by appending "?boolean" but that's no Freemarker Built-in :(

     

    What am I missing here? 


    after .value put ?eval and it will work correctly


  • Claudius wrote:

    I want to try if a board has a realized Tribal Knowledge Base attached to it using this freemarker code (second line is debug output):

    <#assign tkb_present = rest("/boards/id/${coreNode.id}/tkb/realized").value />
    tkb_present has the value "${tkb_present}".
    <#if tkb_present>

    The debug line puts out:

    tkb_present has the value "true". 

    But the if condition ist failing with a NonBooleanException:

    Expecting a boolean (true/false) expression here
    Expression tkb_present does not evaluate to true/false 
    it is an instance of freemarker.ext.dom.ElementModel

    I tried to cast the type by appending "?boolean" but that's no Freemarker Built-in :(

     

    What am I missing here? 


    after .value put ?eval and it will work correctly