Page 1 of 1

Dynamic calculations

Posted: Wed Jun 03, 2009 1:12 am
by Remos
Hi everyone,
I'm new of this Forum.
Maybe my question could be unusual. I'm designing an application to manage a budgeting.
I'd like the user could set calculations up for most of data in the web pages.
Something like he did, for a long time, with excel spreadsheets.
Have you got an idea to models that?

Thanx in advance.
Remo

Re: Dynamic calculations

Posted: Wed Jun 03, 2009 5:00 am
by Mark Baker
If he wants to use Excel spreadsheet style calculations, then use a library such as PHPExcel with it's calculation engine to give him what he's familiar with

Re: Dynamic calculations

Posted: Wed Jun 03, 2009 9:08 am
by Remos
thanx Mark,
but maybe my question is more complicated:
data will not come from an excel file. That's because data are on a mysql db engine, now.
Now they work on web pages developed with php.
I'm looking for a solution to give the users tools to change some kind of calculations on their onwn making the application more flexible.
Ex.:
(before change)
sales Product a=(sales Product a + sales Product bulk a+VAT 20%)

(after change)
sales Product a=(sales Product a + VAT 20%)

I would like that my php code should be able to "catch" that changes, but I cannot find a way to describe it.
I think I need a configuration file to wrap such meta-data.

I don't know if I got it across

Re: Dynamic calculations

Posted: Wed Jun 03, 2009 2:57 pm
by Chalks
I'm not entirely sure what you're asking for, but if you have a mysql database set up already, it should be fairly simple to create a form that will allow your client to input data and have the php handler manipulate the data however you need it done.

If you're unfamiliar with php/mysql manipulation, check out this tutorial

Re: Dynamic calculations

Posted: Thu Jun 04, 2009 1:49 am
by Remos
Chalks,
I know the php/MySQL basics and I've already developed a lot of applications.
But my intent is to find a way to let the user to change that calculation without my actions.

Re: Dynamic calculations

Posted: Thu Jun 04, 2009 2:29 am
by Mark Baker
Remos wrote:thanx Mark,
but maybe my question is more complicated:
data will not come from an excel file. That's because data are on a mysql db engine, now.
Now they work on web pages developed with php.
I'm looking for a solution to give the users tools to change some kind of calculations on their onwn making the application more flexible.
I'm not suggesting that you use Excel ratheer than MySQL for data storage.
But there's nothing to stop you presenting data to the user in a data grid (a series of rows and columns), or to stop you using the Excel-style formulae that your users are already familiar with.

If you want to permit the users to enter their own formulae (whether Excel-style or otherwise) for calculations, then you'll need a calculation engine... you can write your own, or you can find a library that performs that function.
I've offered a suggestion for a library that could provide this function: but if you want to write your own, I'd suggest reading up on Reverse Polish Notation and Dijkstra's Shunting-Yard algorithm