Checkbox UI only field set from formula result?

edited March 2017 in Questions
We have a text field, but tucked away in a drawer.  To alert the user to its presence, if it has contents, we are trying to use a UI only formula field that renders as a checkbox.

For the formula, we are using
if({{field_name}},1,0)

However, the error "1. Invalid syntax for field formula: {{field_name}}. ReferenceError: Test is not defined" occurs.

If we change the formula result to render as text and do
if({{field_name}},"a","b")

then it renders 'a' and 'b' as we expect.

How do we set the checkbox state as a result of an "is the text field empty" query?

Thanks!
greg

Comments

  • edited March 2017
    Did you try true/false?

    IF({{Field_Name}},true,false)
  • edited January 2016
    It gets weirder.  I tried to have something that wasn't dependent on my field:
    if(true,true,false)
    and I tried
    if(1,true,false)

    Both of these should return true in every case.  I get the error:
    Invalid syntax for field formula: if(true,true,false). SyntaxError: Unexpected end of input
    and
    Invalid syntax for field formula: if(1,true,false). SyntaxError: Unexpected end of input


    Likewise other things I tried:
    Invalid syntax for field formula: if(1==1,true,false). SyntaxError: Unexpected end of input
  • Rob HatchRob Hatch 🛠️ 
    edited September 2016
    I'm thinking case sensitivity is tripping you up.  IF not if. 

    Having said that.  Here are a few boolean indicators that work for me: 

    IF({{Amount}}>100000,true,false)

    If you are looking for true, false return - you may not even need the IF function.  This works as a formula in a UI only field.
     
    {{StageName}}=="Needs Analysis"

    Finally - if you want to control the display of warning messages etc based on whether some field is present - you don't need to create a second field,  just do conditional rendering of the the warning message,  or use the conditional statements in our merge syntax to show different messages.  In a template put somthing like this: 

    {{#FieldName}} Thanks for giving us the data {{/FieldName}}{{^FieldName}} Hey dummy - give us the data... {{/FieldName}}

    Refresher:  
    # in the merge syntax means "if there is a some value, do what's next"
    / in the merge syntax means "that's the end of this condition block"
    ^ in the merge syntax means "If there is NO value, do what's next"

    Cheers. 
Sign In or Register to comment.