vendredi 27 janvier 2017

Apply math operations over column of table

This question is about finding approaches to solve a specific problem.

I have a table which has several metrics with values.

[metric1] [metric2] [metric3] [metric...N]

Those columns are fixed.

I need the user to be able to generate calculated metrics using the existing columns.

Let's say that a user made a custom metric which looks like:

[custom_metric] = ([metric1] + [metric3])*[metric2]

Therefore the user would be able to select a report using this custom metrics and other metrics as well.

I have two options. One is to manage this in the database which is a PostgreSQL. Other one is to split the math formula into pieces and store it which I think is the way to go. For PHP I'm using Laravel 5.1. The problem is how to store the formula in a way that could be easily applied when I'm generating the report.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jy0pKX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire