Skip to main content
Matik Help Center home page Help Center
Matik Blog Case Studies
  1. Matik
  2. FAQ and Troubleshooting
  3. Common Errors

Error: (Comparison Operator) not supported between instances of (type) and (type)

This article is related to the following error message:

  • TypeError: (Comparison Operator) not supported between instances of (data type) and (data type)
  • Where a Comparison Operator is typically: <, >, <= ,>=, =. and a data type is typically: 'int', 'str', 'float', 'none', etc.
  • Example message: TypeError: '<' not supported between instances of 'str' and 'int'

This error message is the result of comparing two different data types within conditional logic in your Matik dynamic content. Usually, this is the result of a data quality issue.

The most common occurrence of this error in Matik is when a null value is passed into conditional logic. Matik interprets null values as strings, resulting in the mismatch in comparison types. This behavior is by design since a null value cannot be compared to a numerical value, and Matik does not know the significance of a null value in your data set.

To resolve this issue, you can set up your Dynamic Content queries to handle null values appropriately. For example, let's say you have a "number of active users" metric that displays null when active users are 0. Your Dynamic Content query might look something like:

SELECT
active_users_num
FROM matik_metrics_table
WHERE company_id = &:company_id

To prevent the error above from occurring when there are no active users, we can add a COALESCE() function to replace nulls with 0's:

SELECT
COALESCE(active_users_num,0)
FROM matik_metrics_table
WHERE company_id = &:company_id

The COALESCE() function will replace all null values returned by active_users_num and replace them with zeros. 

Was this article helpful?

Have more questions? Submit a request

Related articles

  • Tags Overview
  • Error: Comparing None value: (logical comparison)
  • Adding Matik Users
  • Dynamic Content Overview
  • Error: TooManyRowsForChartError: There was an error populating the chart for <Dynamic Content Name>...

Articles in this section

  • How to view presentation generation errors
  • Error: TooManyRowsForChartError: There was an error populating the chart for <Dynamic Content Name>...
  • Error: There was an error updating the chart. Google returned 400: Requested writing within range (Cell Range), but tried writing to column(column letter)
  • Error: (Comparison Operator) not supported between instances of (type) and (type)
  • Error: Comparing None value: (logical comparison)
  • Error: Google had an internal error when copying a presentation to your Google Drive
  • Error: We couldn't check for the existence of the Custom Matik Presentations folder in your drive. Have you connected to Google?
  • Error: Divide by zero
  • Warning: Generated with errors: Column does not exist in return value

Comments

0 comments

Please sign in to leave a comment.

Personalize data-driven content in minutes

Product

  • How it Works
  • Security

Solutions

  • Sales
  • Customer Success
  • Ops & Strategy
  • Data

Resources

  • Blog
  • Case Studies
  • Help Center

Company

  • About Us
  • Careers
  • Terms of Service
  • Privacy Policy

© 2022 Matik, Inc.