Using 8.0.17.
I have a dataset with a column totalAmount
of type double
that resides in a table.
Underneath said table I have a numeric text label that sums up the total with an expression on the value property sum({Root Container.Table_Invoices.data},"totalAmount")
.
When there is data in the table, it works as expected, but when a filter is applied to the data and there are no rows, I get a red overlay and the diagnostic telling me there is a Error_TypeConversion.
I tried wrapping the expression with a try(sum({Root Container.Table_Invoices.data},"totalAmount"), 0)
, but that did not work. I can’t check the type of the column either when there are no rows in it
which makes sense, how can no data have a type. But I thought the try would catch this error on it’s own.
This seems like it would be a common thing - using sum()
on a dataset in a numeric text field and the possibility of there being no data in the dataset.
Right now my workaround is if(len({Root Container.Table_Invoices.data})=0, 0, sum({Root Container.Table_Invoices.data},"totalAmount"))
but I feel like there should be a better way. I don’t know if this was an issue that was resolved in a updated version, but I think it would be nice if the try
expression caught the Error_TypeConversion
error so it would not have to be done that way. I was under the impression that try
caught all errors so I was a little surprised when this one slipped through.
I hope I provided enough context to recreate this error but I can give more details if required. If someone could tell me the “proper” way, or if this is expected behavior, or if it was a bug that was solved in a newer version, please let me know.