[REJECTED] Allow Javascript in Formulas

Loving both formulas and action buttons so far.

Would it be possible to use the same power of Javascript in action button scripts in formula calculations?

I guess it doesn’t really make sense to mix and match the current formula methods and Javascript, so it possibly have to be a toggle (and lossless going from Formula to JS, but not the other way around).

The main use cases I’m thinking of is when a field is a complex function of other fields, but the action button solution means you have to press the button periodically to keep the produced field up to date. Maybe another solution is {cron} for action buttons!

I’m curious to hear what functions you need to create that you can’t currently achieve with formulas…

1 Like

I suppose, that for your case you can divide the process into two parts - flexible one reached with Formulas, and static one with the Button.

I am curious about the certain Use Case as well, looks pretty curious :wink:

I think two examples come to mind:

  • I could be wrong about this, but I think in formulas you can’t apply Max to non-arrays? So e.g. Max(some_field.value, 3) can’t be done, which means it needs to be done as if(some_field.value > 3, some_field.value, 3). That’s not too bad there, but when the calculated values are themselves big formulas, you have to write them multiple times (or create a separate field)
  • Wanting to see a recurring date - e.g. renewing a contract every year, or e.g. a birthday. You put the original date as a field, but how to get the date “this year” (or say, between two months ago and ten months from now?) Maybe there’s some way with the current formulas (ToDays(Today() - OriginalDate) modulo 365… added to/subtracted to based on value)

But more generally just any complex calculation! E.g. even sqrt?

And in these cases, I want the field always up to date. Currently I can define a button to update the fields here, but then I have to (a) press the button somewhat routinely to get the latest value(s) (b) press it when a new entity is created

Sounds like a deficiency in the available functions in formulas (and elsewehere?) rather than a requirement for scripting per se.
FWIW I noted that recurring dates has been mentioned by others previously:

1 Like

I think for recurring dates yes that’s right.

But more generally I don’t think so: I think it would become a mess if formulas had to replicate the full flexibility of e.g. Javascript (well, not including dependencies and external calls let’s say). Even on the recurring dates, that was just one simple example, but if the original date is very useful too, you might need ever more complex functions with dates.

My experience here is drawn from Tableau, which has a very flexible internal DSL, but honestly I always found it somewhat painful once things got complex: you can tell it’s just not well made for that.

I’m open to being wrong, and indeed it would be great to see a strong implementation of “formulas” that works better than Tableaus while matching the flexibility.

Just to update on this:

I had actually set the button to update all entities of that type: if you clicked the button on any entity, it would update all of them. The reasoning was so that I wouldn’t have to click a huge amount of times to have all entities with updated fields.

This was working great… But now I’m timing out! I’m hitting the 1000ms limit (Unable to complete execution because CPU limit of 1000 ms reached).

Is there a way to extend this limit? I can post this as a separate topic too if that’s helpful.

Not a great permanent solution or one that pertain to the topic, but if you really need to, another option is to use their API from outside Fibery.

I started working on my own Fibery client to make interaction much easier, and I am currently using some of its basic features. It needs a re-write since it’s still not good enough.

1 Like

I think you’re right @Haslien, that’s likely the best solution. In some respects it’ll be better than an action button for these situations since I can run it on a schedule automatically.

Hi!
Your requests sound curious!:face_with_monocle:
Could you please share with us your case?

Btw, if you share your script with us, our developer will have a look and maybe advice smth :slight_smile:

Since you brought it up, would definitely like to see some native Recurring Dates handling. One of my big reasons for being in Fibery is ease of doing workarounds for things like Recurring, which is something you have to use formulas and workarounds to achieve in all of Airtable/Notion/Coda.

Cheers!

2 Likes

I don’t think we will allow JS in formulas. It will make everything much more complex. However, we will improve formulas power and doing it all the time. So please ask for specific cases you want to handle in Formulas in separate requests and we will consider them.

3 Likes