Posted 8 September 2017, 2:05 pm EST
Let me start by setting up the scenario:
- I'm using Spread to build a configuration tool for management reports. These reports make use of the built-in functions, and also some (a lot of, in fact) custom functions that get data from an accounting software's database.
- Besides these custom functions, there're some parameters that are added to the spread as custom names (ie, variables), that are used as one of the parameters in most of the custom functions.
- Up to this, no problems (or close to none )
My problem is, some of the used custom functions don't have any parameters. When I call SheetView.Recalculate(), these functions don't get recalculated. I even tried marking these parameterless as volatile, to no avail (the IsVolatile() override isn't even called).
Granted, the return value of these functions rarely changes, as they're usually functions that get static data from the database, such as a company's name, or address. The problem is, these functions never get calculated, which means that whenever I open a previously saved report, the cell containing any of these functions gets the well-known value of #NAME?, and it never changes. The only way to get it calculated is by deleting the corresponding cell's contents, and inputting them again.
I know that by calling SheetView.RecalculateAll() will also recalculate these functions, but I can't do that, or I'll penalize the performance.
I've also seen some workarounds by putting a dummy parameter in these functions to force a recalculation, but I also can't do that, or the users would shoot me .
Is there any other way to accomplish this?