Hello,

I have a question about formulas inside cells. I need to use different formulas for price calculations on each row. Is it possible to trigger some kind of formula, which can scan “value” variable and use it as a formula?

We have really complicated price calculations based on models, surcharges, endurances of a product etc.

We are Door reseller and each record is Door with different configuration(size, type, model, surface, hardware, glass etc.). I don´t know how could I make database design of those configurations so we are doing it with formulas. More elegant solution would be pricelist of each configurations, but that would be insanely lot of duplicated rows with just one different feature.

There is a Python function exactly for that: `eval`

. Those are equivalent:

```
print("test")
value = 'print("test")'
eval(value)
```

There is an example here, in the definition of `matching`

column.

Just remember that `eval`

could be a security hole, allowing bypassing Access Rules if you let unprivileged users define the content of `value`

.

Thank you so much for your reply!

So if I want to enter in the cell a formula like “3490+500+470” and hit enter, the trigger formula eval(value) would use entered value and convert it to formula? I tried it and it didn’t work. It wrote Type error unfortunately.

No, I think you can’t use it directly that way. You should define a `Formula`

column, and another column that will evaluate it and give the result. Sample here: the `Formula`

column contains your formula, and the `eval`

column is defined as follows:

```
$Formula and eval($Formula)
```

Note the `Column Type`

of `Formula`

is set to `Text`

.

If you try to do what you wrote (as in `Trigger_eval`

in the sample), the cell won’t store the formula, but its result (as would directly entering): so no interrest.

Even if it doesn´t solve exactly what I need, It could be workaround. Thank you for your precious time!