Alternatives to DB Functions

Background
I have setup tables of faults.
I am thinking about making some pages for the probabilities of events.
I was recommended to make a function for factorials to store on the database to call in the query.

Question
I avoid making functions on my db though because I cannot view them in Ignition.
What are other options?

Example sql function I was given
image

I am not sure what the purpose is, but calculating factorials on the fly every time is ... going to be expensive. Maybe that is the intent for some reason (make a user wait to slow down brute force attacks, make it easier for a DoS attack, heat the room, ...)
Otherwise, calculate the factorials at design time, put them in a table (or dataset in memory), and do lookups instead of calculations.
But maybe I don't understand the question at all.

1 Like

The lookup table is a good idea, thanks.


I thought getting the probabilities would lead to good plans.

After you said to make a lookup table for the factorials, one evolution of the idea became evident to me.

I should skip the probabilities and make a lookup for replacement schedules of parts.

Anyone know a good source for such a spreadsheet for contactors and other parts?