# Alternatives to DB Functions

**URL:** <https://forum.inductiveautomation.com/t/alternatives-to-db-functions/75113>\
**Category:** Ignition\
**Created:** [June 15, 2023, 8:41pm UTC](https://forum.inductiveautomation.com/t/alternatives-to-db-functions/75113 "2023-06-15T20:41:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [June 15, 2023, 8:41pm UTC](https://forum.inductiveautomation.com/t/alternatives-to-db-functions/75113/1 "2023-06-15T20:41:53Z")

</div>

**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](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/a/6af9901f3dd1545357be76fdea65d84ccec0493d.png)

---

<div class="post-metadata">

**Author:** ![Tim\_Carlton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim_carlton/32/52835_2.png) [@Tim\_Carlton](https://forum.inductiveautomation.com/u/Tim_Carlton)\
**Post date:** [June 16, 2023, 12:23pm UTC](https://forum.inductiveautomation.com/t/alternatives-to-db-functions/75113/2 "2023-06-16T12:23:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [June 16, 2023, 12:59pm UTC](https://forum.inductiveautomation.com/t/alternatives-to-db-functions/75113/3 "2023-06-16T12:59:11Z")

</div>

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?
