Category: How do I do X?


This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to display a different text boolean json?


I have two tables with keys and values, but the keys are not in order. I need to compare the values of the matching keys between the tables and highlight the background if they are different. My code is not working, and I need help to fix it.


The solution involves using a ternary operator in order to display different text values based on the boolean value. In this case, the ternary operator checks whether the boolean value is true or false and displays "natural" or "synth" accordingly.

For example: {{currentRow.Nat == "true" ? "natural" : "synth"}}

In order to compare two tables with different orders of keys and highlight the background if the corresponding values differ, you can use an if statement within a function. The function checks if the key exists in the first table, retrieves its corresponding value, and compares it with the value in the second table. If they differ, the background is highlighted in red.

Example code:

{{(function(){  if(Object.hasOwn(, currentRow.Brandkey)){    const val1 =[currentRow.Brandkey];    if(currentRow.Value !== val1) {      return 'background-color: red';    }  }  return 'background-color: transparent';})()}}