-
Notifications
You must be signed in to change notification settings - Fork 47
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
DOC: discrepancies between doc and custom formulas behavior in v18 #5219
Comments
also: throwing custom "LOADING error" seems not to work anymore, could this be? |
Hello 👋 It is an intended change, now the arguments of the functions are FunctionResultObject. This was made so we could also have errors as arguments (eg. TRANSPOSE can now have errors in its range). You can still use the usual helpers to convert them to primitive types. Or use Throwing errors should still work tho, do your custom error extends EvaluationError ? We didn't change much there AFAIK. |
i see, is the function expected to return a single scalar or should it also be an object of the new shape ? and i had a question in past, maybe now this is covered by the new update: is it possible for a formula to get the coordinates of the cell and sheets of where it is being executed ? i need to use this unique key as a cache key for async cells. UPDATE: i found out that there a variable: this.__originCellPosition available inside a formula, i believe i can use this one ? Also this brings me to an important matter, in version 16 (the one i am currently using) it was possible to directly modify the "this" object inside the formulas, so as to add useful internal state variables. i have the feeling that now the context of the "this" object is always reset at every dispatch iteration, so i cant use it like before.... is this correct? |
Hello @dberardo-com 👋 Yes As for the Line 89 in baac24b
|
thanks for the reply.
indeed, this is a great addition for my use case. although there have been instances where this variable was null/undefined for a couple of iterations ... i would just ignore it in that case-
i understand, i thought that was the case but wanted to go sure. i think i will go for the custom plugin variant. and just to be sure again: custom plugins are singleton inside a spreadsheet model, i.e. there will exist only one instance of any plugin inside the model and all formulas share it, is this correct? also, talking about cache: is there a way for a plugin that manages a shared cache to recognize when a formula is "unmounted (deleted or so)" in order to clear the cache resources related to that specific formula instance (cell) ? |
That's ... strange. It seems like a bug if it does, can you provide a basic case where it happens so I could investigate ?
Plugins are indeed a singleton, they are initialized in the constructor of the mode and never again.
On the top of my head I don't think it's easily possible unfortunately. |
using version 18, defined custom formulas are not given single scalar as input but rather objects:
the first argument of mz custom function is now suddenly an object: {
"value": 1,
"formattedValue": "1",
"type": "number",
"isAutoSummable": true,
"defaultAlign": "right"
}
and successive arguments are also object of this shape: {
"value": 123,
}
is this breaking change by design or is there something wrong with my setup ?
ref: https://github.com/odoo/o-spreadsheet/blob/18.0/doc/add_function.md
The text was updated successfully, but these errors were encountered: