Forum Discussion

Acorn999's avatar
Acorn999
Brass Contributor
Jul 14, 2023

Incompatible types for comparison. These types can't be compared: Table, Number.

My app uses a gallery of buttons to act as tabs and create a tabbed form. See screenshot.

Each field in the form Visible property is set to either true so it shows on all tabs or set to 

varTabSelected=X so it shows only on a specific tab, where X is the ID of the button.

 

The back end of the app is a SharePoint list. The field is a Single Line of Text. In PA, the field name is  DataCardValue14. The intention is to fill the gallery as green if the field has a value and grey if the field does not have a value. I set the Visible property to true so the field always shows and visible property is not a contributing cause in this issue. 

 

No matter what, this code for the Gallery Fill property returns true, even if the field is blank / null:

If(Not(IsBlank([DataCardValue14]), Color.Green, Color.Gray)

 

If I set the value to 5, or the default to 5, and then set Gallery Fill property to:

If([DataCardValue14] = 5, Color.Green, Color.Gray)

PA shows ""Incompatible types for comparison. These types can't be compared: Table, Number."

PA does not see DataCardValue14 as a text or number. Instead, it sees DataCardValue14 as a table. 

 

If I try to cast the DataCardValue14 as Text:

If(Not(IsBlank(Text([DataCardValue14]))), Color.Green, Color.Gray)

PA shows "Expect Text or Number. We expected a text or a number in this point of the formula."

 

Why does PA think this value is a table and what can be done so the formula properly evaluates to true or false?

 

 

  • Resolved my issue by removing these brackets from Fill property DataCardValue [],
    It seems these brackets around a DataCardValue will set the value as a table. This caused the issue for If(Not(IsBlank to always return true.

    Issue:
    [DataCardValue14.Text]

    Issue resolved
    DataCardValue14.Text

    Before fix:
    If(varTabSelected = ThisItem.ID, RGBA(0, 120, 212, 1),If(Not(IsBlank([DataCardValue14.Text]))&&ThisItem.ID = 2, Color.Green, Color.Gray))

    After Fix:
    If(varTabSelected = ThisItem.ID, RGBA(0, 120, 212, 1),If(Not(IsBlank(DataCardValue14.Text))&&ThisItem.ID = 2, Color.Green, Color.Gray))
  • Acorn999's avatar
    Acorn999
    Brass Contributor
    Resolved my issue by removing these brackets from Fill property DataCardValue [],
    It seems these brackets around a DataCardValue will set the value as a table. This caused the issue for If(Not(IsBlank to always return true.

    Issue:
    [DataCardValue14.Text]

    Issue resolved
    DataCardValue14.Text

    Before fix:
    If(varTabSelected = ThisItem.ID, RGBA(0, 120, 212, 1),If(Not(IsBlank([DataCardValue14.Text]))&&ThisItem.ID = 2, Color.Green, Color.Gray))

    After Fix:
    If(varTabSelected = ThisItem.ID, RGBA(0, 120, 212, 1),If(Not(IsBlank(DataCardValue14.Text))&&ThisItem.ID = 2, Color.Green, Color.Gray))

Resources