Ignore null on text props perspective Text Field

Hi all

Does anyone know a way we can ignore 'null' values on text props?

Screenshot 2023-08-22 155308
Screenshot 2023-08-22 155251

Yes: close your eyes and pretend it's not there.

We need more details about what you're doing: How is text populated, what you're trying to fix, etc.

The text field is binded to a custom component property which the object is populated from a database query returned as a json.

Screenshot 2023-08-22 161641

I'll assume you need to keep the nulls in the custom.data property because you need that data for other things, and that the text property is a simple property binding.
I'd change that property binding to an expression binding that would look like this:
coalesce({property_path}, default_value)

With default_value probably "", but you can put whatever you want to use instead of null

3 Likes

@avantica Update your SQL query like:

SELECT 
ID,
isnull(Address1, ' ') AS Address1
FROM Sample
2 Likes

While it's (probably) usually better to handle things in the query, in this case I wouldn't, because he might need the nulls in the source data and to only replace them in some labels.
But that's just an assumption I'm making. Nulls are a valuable absence of value !

1 Like

We need to see your binding. The best option is probably just to capture the null value in a transform and return an empty string to the Text Field instead.

2 Likes

I'm guessing his binding is a property binding, which makes the transform overkill when there the coalesce expression function available.

Edit:
huh, scratch that.
If custom.data is dynamic, the binding might not be a simple property binding.