ExcelAsyncUtil.Run - #NA and cache

885 views
Skip to first unread message

Jiri Pik

unread,
Feb 10, 2013, 6:32:13 AM2/10/13
to exce...@googlegroups.com

The asynchronous support is amazing but I found two issues with which I am not sure how to fix:

 

1.       When the Async call is being made, the excel shows in the cell #NA – is it possible to change it to something like “Computing …..”  or so? The problem with #NA is that it is misleading as the result of calculation, rather than the status, may be #NA

 

2.       With Async function, the result is somehow super-volatile, as it is calculated and as soon as the result pops up, the cell becomes #NA and it starts all over again. I have solved with using a cache of calced values but is there a better way?

Govert van Drimmelen

unread,
Feb 10, 2013, 6:52:08 AM2/10/13
to Excel-DNA
Hi Jiri,

1. You can wrap the async call in order to return anything else as the
'busy' value. If your function itself might return #N/A you might need
two wrappers. See this answer for more details:
https://groups.google.com/group/exceldna/browse_frm/thread/dedf10eb5ea4f100/4406fdc86a3ca1ad

2. Async functions should be no more volatile than regular functions -
they should only recompute if the sheet is being recomputed, or if one
of the inputs change. But if the async function has completed, and now
you recalculate the sheet or change an input, indeed the whole
(possibly slow) async call starts again. Caching the result is a good
way for you to control how often the possibly slow work should
actually be done. I'm happy to consider ideas on how this should work
better. Perhaps Excel-DNA must just add some support to easily cache
function calls?

Instead of the async functions, you might also look into the Reactive
Extensions support, which allows you full control on how new values
should be pushed to Excel and when the async observable should be
"completed". There are some details here:
http://exceldna.codeplex.com/wikipage?title=Reactive%20Extensions%20for%20Excel

-Govert


On Feb 10, 1:32 pm, Jiri Pik <jiri....@googlemail.com> wrote:
> The asynchronous support is amazing but I found two issues with which I am not sure how to fix:
>
> 1.       When the Async call is being made, the excel shows in the cell #NA - is it possible to change it to something like
> "Computing ..."  or so? The problem with #NA is that it is misleading as the result of calculation, rather than the status, may be
> #NA
>
> 2.       With Async function, the result is somehow super-volatile, as it is calculated and as soon as the result pops up, the cell
> becomes #NA and it starts all over again. I have solved with using a cache of calced values but is there a better way?
>
>  smime.p7s
> 8KViewDownload

Jiri Pik

unread,
Feb 10, 2013, 7:01:28 AM2/10/13
to exce...@googlegroups.com
Hi:

Thank you very much for the response.

Yes, some standard ExcelDNA cache would be nice as I am pretty sure that everyone else is implementing their own caching. The
questions with caching would be how often to refresh the cache, if the cache should be populated on AutoLoad.
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply all
Reply to author
Forward
0 new messages