Error value type when creating a formula based on a table

Hi Everyone,

I am new here, and also new to coding (did object based VBA - MS Office only my whole life), I count on your patience.

I am creating a price quote tool in Retool and I am trying to determine the result of a range to be added to a text box, but I keep encountering the error "Error the value has to be of type number | void, you provided a value of type string.

The table is formatted for every single column either as currency or number, and the price is also formatted as currency. I can see in the code that cnormal.value is recognized as a value, without "" but every item from the table is recognized as a string with "", I don't know anymore how to resolve this.

I appreciate any help, thank you.

Andrei

image

Hey @Andrei_Quintan!

That code syntax looks like it might work in a standalone transformer with some slight adjustments (namely, including a return statement for x and removing the parentheses around the x = ... statement).

When you're entering a value into a setting field for a component, however, all JavaScript needs to be contained as a single expression in a set of {{}}. In this case, it might be something like the following:

{{ cnormal.value >= table1.data[0].Min && normal.value <= table1.data[0].Max ? table1.data[0].BasePF : 0 }}

Does that help?

Retool will try and detect the value based on the syntax of the field to see if it matches something like number, boolean, array, or JSON object, and otherwise simply return a string representation of the input passed (with all expressions {{}} evaluated and interpolated).