3 ms·
I wrote an algebraic equation systems solver to compute KPIs from user text equations. The user would upload a spreadsheet file that contains hundreds of equat
by Jugurtha 7y ago
I wrote an algebraic equation systems solver to compute KPIs from user text equations.
The user would upload a spreadsheet file that contains hundreds of equations for different "KPIs", and the solver would go through them, look for the variables in database tables and columns, and then solve the system.
Example:
kpi1 = sales.clients + marketing.last_year_accounts – kpi2*legal.billable_hours
sales, marketing, legal being database tables, and clients, last_year_accounts, billable_hours being column names. kpi2 is another KPI defined somewhere solved iteratively.
I squinted my eyes hard looking at one equation that used to be solved that raised an exception. As a matter of fact, I don't know if you have spotted it in the equation above.
The problem is the dash[0] instead of the - (minus). It would be "minus", then somehow Excel would transform it to an en dash if I recall correctly. Since I used abstract syntax trees and parsed the equations, it threw the solver off.
I remember at some point, I just noticed a difference in length compared to the - sign.
[0]: https://en.wikipedia.org/wiki/Dash https://en.wikipedia.org/wiki/Dash