Bug 161540 - Add functionality in the functions deck to save formulas and edit them
Summary: Add functionality in the functions deck to save formulas and edit them
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Ahmed Hamed
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 92416
  Show dependency treegraph
 
Reported: 2024-06-12 23:11 UTC by Ahmed Hamed
Modified: 2024-08-01 07:19 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Hamed 2024-06-12 23:11:02 UTC
Description:
This is a new feature that will enhance the experience of dealing with the functions panel. Formulas can be saved or added to cells, and saved formulas can be edited, so the effect is applied to all linked cells or to a specific one or saved for future cells. Saved formulas can have a name, arguments, and a description.
This means that you can choose between functions and saved formulas to add to a cell.

What are other features you wish to see here? And what adjustments can be done to this proposal?

Actual Results:
---

Expected Results:
---


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 342670dc6b0fc5b93a40b9cf86b8cca67fac88a3
CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Heiko Tietze 2024-07-26 08:26:55 UTC
Storing functions sounds like a desirable feature. And usually I am the first to raise the hand when it comes to extensions but in this particular case it might be a bit far-fetched.

The function-set could be something like

=ABS(ACOS(ACOSH(ACOT(AGGREGATE(ASIN(2);0;C$10:C$15;...

using constants like asin(2), or single cell references like asin(A1) or ranges C$10:C$15.

On saving/reloading such a function-set I would not expect any parameter to adjust somehow to the new sheet. It behave like copy/paste and relative references are adjusted while absolute remain static.

Rafael, any opinion?
Comment 2 Rafael Lima 2024-07-26 12:54:09 UTC
This is usually achieved via Basic functions that can be called from Calc. For instance, you can create a function as:

Function Increment(x)
    Increment = x + 1
End Function

And then in any cell you can enter =INCREMENT(B5) in a cell to apply the custom INCREMENT formula.

The OP seems to be requesting a way to achieve the same result, but without programming.

What comes to mind is a way to define a custom formula marking where arguments would be placed. For instance:

=MAX(0,SUM(%1))

Suppose I define the formula above and cal it NONNEGATIVESUM. Then the %1 can be used tell Calc where the first argument will be placed when I call =NONNEGATIVESUM(B5:B10) for instance.
Comment 3 Heiko Tietze 2024-07-30 10:07:39 UTC
(In reply to Rafael Lima from comment #2)
> The OP seems to be requesting a way to achieve the same result, but without
> programming.
Ahmed is improving the functions sidebar in a GSoC project. This ticket is cherry-picked from bug 92416 where the OP has made this statement of "editing functions in the sidebar _would be nice_".

See also bug 92416 comment 8. The inline-'see also' trace back to bug 74156, which is why I recommend to not manipulate content via sidebar but just show information and pick single data points.
Comment 4 Ahmed Hamed 2024-07-30 22:03:01 UTC
What Rafael described is indeed what I intended to do. But I agree with you, Heiko. I think this functionality is not meant for the FD to handle. I also think it would be complex to implement if we decided to do it elsewhere.
Do you have a related idea that we can work on instead?
Comment 5 Heiko Tietze 2024-07-31 07:58:45 UTC
How about some kind of favorite category and add/delete interactions to store a function set on this category? Similar to the concept at special characters.
Comment 6 Ahmed Hamed 2024-07-31 20:21:26 UTC
This is a good idea. I'll make a new ticket for it and you can close this one.