This is a follow-up of bug 161338 Steps to reproduce: 1. Open attachment 194447 [details] from bug 161338 2. Execute the following code Sub TestGoalSeek oSheet = ThisComponent.Sheets(0) oTargetCell = oSheet.getCellRangeByName("D1") oVariableCell = oSheet.getCellRangeByName("C1") oResult = Thiscomponent.seekGoal(oTargetCell.CellAddress, oVariableCell.CellAddress, "100") MsgBox oResult.Result End Sub 3. Go back to the sheet -> C1 and D1 become #N/A
Reproduced in Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: a298ba36047e17cf6a0f6b3d17ae40aed282f47b CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3 Locale: es-ES (es_ES.UTF-8); UI: en-US Calc: threaded and Version: 7.3.0.0.alpha1+ / LibreOffice Community Build ID: 229123ccc6f90ebf66b3e659bebbd53f8a9bdd3a CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3 Locale: fr-FR (es_ES.UTF-8); UI: en-US Calc: threaded
@Rafael, @Mike, I thought you might be interested in this issue since you fixed bug 161338
We explicitly kept the behavior of the XGoalSeek's seekGoal. Rafael even mentioned that explicitly in the commit message [1]: > Note that the solver definition in ScDocument::Solver forcefully inserts N/A > when the solver fails, which seems to be usefull when creating scripts that use > the Goal Seek. I don't know why is that done. I also kept that, changing the implementation that actually writes that #N/A. Since this could be an API break, I would like to know why was that done initially. [1] https://git.libreoffice.org/core/+/d05f1ec2e20eb86ceb99e9ff5d4efb9ff9356dbb
I see, at least it would be nice to be able to undo it, so the values are restored
On the second thought - it is valid. Let's remove that oddity, and see who shouts :-)
(I have no spare cycles at the moment, please take it if you like)
(In reply to Mike Kaganski from comment #5) > On the second thought - it is valid. Let's remove that oddity, and see who > shouts :-) You mean remove the "N/A" even on macros? TBH I think this may have been an implementation error back when Goal Seek was introduced. I'm in favor of removing this oddity as well.
(In reply to Rafael Lima from comment #7) > You mean remove the "N/A" even on macros? Yes :-) Somehow, Xisco forgot to assign this to himself: https://gerrit.libreoffice.org/c/core/+/169035
(In reply to Mike Kaganski from comment #8) > (In reply to Rafael Lima from comment #7) > > You mean remove the "N/A" even on macros? > > Yes :-) > Somehow, Xisco forgot to assign this to himself: > https://gerrit.libreoffice.org/c/core/+/169035 yep, sorry for that!
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/98c74adf2e1945599f693c26d72141553bd7955b tdf#161616: do not set error when XGoalSeek fails It will be available in 25.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Xisco Fauli committed a patch related to this issue. It has been pushed to "libreoffice-24-8": https://git.libreoffice.org/core/commit/302029b9cd41ac31a5be3787147a86a4f9e507de tdf#161616: do not set error when XGoalSeek fails It will be available in 24.8.0.0.beta2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.