Hi all
Does anyone know a way we can ignore 'null' values on text props?
Hi all
Does anyone know a way we can ignore 'null' values on text props?
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.
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
@avantica Update your SQL query like:
SELECT
ID,
isnull(Address1, ' ') AS Address1
FROM Sample
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 !
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.
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.