-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculation engine executes statements on every branches #788
Comments
This is most definitely not a bug report, a bug report would be when the calculation engine returns an incorrect result for a formula (eg if C12 was returned in your example rather than B12). PHPSPreadsheet uses a simplistic stack-based parser for the calculation engine, which evaluates all the data necessary for a function (all the arguments) onto the stack before executing the function itself. For most functions, this is more efficient than alternative approaches, because the arguments for most functions are pre-determined and required; and it is only a few functions like the IF() functions where it isn't efficient. I have done some prototyping work on alternative approaches to evaluating formulae and that would make the calculation engine more manageable, it is a non-trivial piece of work, although it would have other benefits such as better handling for errors, the ability to handle array formulae (even 3d arrays), and support for row and column references (not simply cell and range references). However, this is still very much an experimental prototype, and will take a lot of time and effort before it's stable enough to start integrating into PHPSpreadsheet itself. |
@MarkBaker I have implemented something keeping the stack based parser and tagging tokens to enable pruning. #818 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Not stale! ;) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Nope, mean bot! Not stale! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Not stale, pending review dear bot! |
Resolved through 0b387e7 |
This is:
To be honest I am not sure whether it is a feature request or a bug report.
What is the expected behavior?
If we take the example of an IF statement like
IF(A1="YES";B12;C12)
we could expect that A1 contains the valueYES
we should only resolve the value in the cell B12.What is the current behavior?
Currently B12 is resolved and reutrned correctly, though
C12
is evaluated too which causes extra, not required, computationWhat are the steps to reproduce?
Using
1.5.1
and the following file: repro.xlsxAlter the
Calculation::calculateCellValue
method to just log the name of the resolved cell. Like:Which versions of PhpSpreadsheet and PHP are affected?
The text was updated successfully, but these errors were encountered: