Re: [ExcelDna] Problems with Asynchronous functions

700 views
Skip to first unread message

Naju Mancheril

unread,
Sep 28, 2012, 7:57:57 AM9/28/12
to exce...@googlegroups.com

Kesey,

How are you using the asynchronous support? Are you inheriting from RtdServerBase? Or are you using an async util method?

Can you provide some more details on how the logic *should* work? If two cells call with TODAY() (pass same date params) then what do you think should happen?

Should you call out to the Webservice one and share? Or twice?

Is the webservice call taking the dates as params?

Do you ever need to call back the webservice even if Excel does not run you again? That is, is the webservice's data set changing in the background and do you want to show these changes in Excel?

Are you sure everyone is using TODAY() and not NOW()? This has broken stuff for us before. No one should be using NOW().

On Sep 28, 2012 4:34 AM, "KeseyJones" <luis.a...@bbva.com> wrote:
Hello everyone,

I have doing a new functionality in my addin using the asynchronous capability and I have a bit problem. I have created a non-volatile function and this function accept an argument where I insert a date. If I use the "today" function to fill this argument, this action convert my non-volatile function in a volatile function.
The problem is when in my excel I use this functions in different cells. How the content of my internal thread waste different time doing the work, the function end in different moment in each cell. And here I have the problem. Every time that some function end and call again the function with de asynchronous funcionality to show the result, the rest of functions are call again. I think is beacuse this functionality has a beahvior like to press SHIFT+F9 and refresh all the volatiles functions.
For me this is a big problem beacuse all my functions are constantly executing, and my excel start a infinite loop, calling the functions all the time. Someone know what can I do to solve the problem?

This function connect to Web Service in order to recover a data and I always have to connect in order to know the data have changed. 

Thanks, Regards

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To view this discussion on the web visit https://groups.google.com/d/msg/exceldna/-/t5CkoXSZ5asJ.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.

Govert van Drimmelen

unread,
Oct 1, 2012, 6:17:33 AM10/1/12
to Excel-DNA
Hi Luis,

I think Naju is pointing out that everything you describe is working
as it should - the TODAY() function is volatile, and will cause your
async function to get called again on every calculation. And your
async function will be 'reset' after the async call completes, so if
called again it will start a new async call. The combination of the
volatile input and the async functions in your sheet are causing
continuous recalculations, which is correct.

I can suggest a few workarounds:
- Create your own =myTODAY() function that is not volatile.
- Create your own =myTODAY() function based on an RTD server (or
Reactive Extensions IObservable), only updating Excel when the day
actually changes.
- Change your async function to cache recent calls - check the input
arguments and return an immediate result for recent (you decide the
timeout) calls with the same arguments.
- Change your async function to be an RTD server (or Reactive
Extensions IObservable) that internally polls the web service, and
pushes the results to Excel.

I hope this puts you on the right track.

Regards,
Govert


On Oct 1, 8:32 am, KeseyJones <luis.arang...@bbva.com> wrote:
> Hello,
>
> I am using this function ExcelAsyncUtil.Run to use the asynchronous
> support. I copy to you the interface of my method.
>
>               [ExcelFunction(Description = "Get a single point", Category =
> "Typhoon", IsVolatile = false, IsMacroType = true)]
>         public static object TyphoonGetPoint(
>             [ExcelArgument(Description = "Name")] string name,
>             [ExcelArgument(Description = "Date")] object date,
>             [ExcelArgument(Description = "DataSource")] string datasource,
>             [ExcelArgument(Description = "Field: Spot, Dividend,
> Swaption...")] string field,
>             [ExcelArgument(Description = "Active formatting output?")] bool
> format
>
>         )
>
> My method have to look for the data in a webservice. I use the following
> parameters Name, Date, DataSource anf Field to send the webservice and the
> webservice have to return me the data. The user only use the today() method
> and when the use this function my method will be volatile. My function have
> to connect the webservice to refresh the data and it is the only way to
> refresh the data because.
>
> I don't know if I explain you the problem.
>
> Regards.

Naju Mancheril

unread,
Oct 1, 2012, 8:59:44 AM10/1/12
to exce...@googlegroups.com

Luis,

In an ideal world, if the result of TODAY() does not change between calls, what do you want to happen?

Would you be happy if the implementation just returned the previous cached value without calling out to the webservice?

Reply all
Reply to author
Forward
0 new messages