Have text component value rendering dynamically, want to apply JS function to transform it

I have a list view that dynamically renders a collapsible container, within which I have a text component which is correctly displaying data with the following:

{{Date.now() - Date.parse(filterStatus.value[i].milliseconds)}}

This successfully renders in the UI, displaying different millisecond values. I want to transform this data into a more readable format, and I have a JS transformer containing a function that does that.

timeTransform(ms) {some code to transform ms to readable format}

My transformer currently returns this function.

My question is - how can I apply my function to the values in the text component? When I try and access the function via timeTransform.value, its value is null.

Is it possible to use my timeTransform function inside of the text component's value, passing the dynamic value into the transformer?

Feel like I might be missing something obvious.

Hello, I don't think transformer is intended to be able to return a function. I've tested and while it saved, the preview returns error. If it just the text component's value that you want to format, you can try preloaded js: https://docs.retool.com/docs/custom-js-code

1 Like