Javascript Formatting in Text control

Hi,

I'm new to Retool and since formatting options are limited, I'd like to know how to format text in a text control.

I tried using the checkbox control but there is no read-only feature and there was no way to disable user changes whout greying-out the control.

What I want is: "Feature is ON" and "Feature is OFF".

What I get is "Feature is ".

Thsi works fine when query.data.Results[0].IsFeatureEnabled is not null, but it fails otherwise.

The problem appears to be query.data.Results == null is never triggered. How do I check for a null object in retool javascript?

Code in Value box:
Feature is {{ query.data.Results == null ? "OFF" : (query.data.Results[0].IsFeatureEnabled ? 'ON': 'OFF') }}

Hey @Francis!

Great question! Does this query run on page load? Is there a chance that query.data == undefined which is triggering false for your ternary condition here? Would you mind sharing an example response from your query?

The issue was query.data was null, so trying to access query.data.Results would throw a page error.