Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database Storage of Formulas with Variables

This is a little complicated, so bear with me.

My employer is asking to build a system that calculates task iterations from a set of variables.

Each task in a project has a specific formula used to calculate the number of times the task needs to be accomplished ("iterations"). The formula could rely on constants, variables (number-entered, so a task might be related to the number of suppliers we have or the number of offshore employees, and these values may be different for each project), and/or time (e.g. once per month, once per quarter, once per 6 months, once per year)

How can I design a database to hold these formula so that I can calculate them later?

Example formulas:
Once per month per supplier.
Twice per quarter per supplier per customer.
Once per month for every six suppliers.

Tech stack is C#, .NET 3.5, SQLServer 2005.

like image 421
Matthew Jones Avatar asked Dec 22 '22 08:12

Matthew Jones


1 Answers

Have a look at NCalc (Codeplex) You can embed that parser in SQLCLR, and save your formulas in tables.

like image 159
Nestor Avatar answered Dec 27 '22 02:12

Nestor