Issues with AsyncFunction

Posted by: daniel on 23 May 2019, 2:41 am EST

  • Posted 23 May 2019, 2:41 am EST

    Hi there,

    We are seeing two issues with async formulas.

    For context: we’ve created a custom async formula “DATA”. It basically takes a string parameter and goes to an API to fetch data. The resulting data is a number. This number is what the function returns.

    For example: DATA(“something”) returns 1.234

    We see both issues mentioned below in a clean sheet, with a single DATA(“something”) formula entered into cell 1,1

    Issue one: It seems that the evaluateAsync JS function is called three times when we enter a DATA formula into a cell.

    Issue two: When we load the example sheet with one populated cell from our database, our code populates the cell using the sheet.setFormula function. We confirm that the cell is populated with our DATA formula and the formula executes and returns the expected result. But the moment the evaluateAsync JS function is done, a “CellChanged” event fires, saying that the cell has been changed to the value of 1.234 (i.e., raw number, not formula). Double clicking in the cell that we just loaded we no longer see the formula, but the value 1.234. So the formula is gone.

    Are we using async formulas incorrectly?

    Daniel

  • Posted 23 May 2019, 9:28 pm EST

    Hi Daniel,

    We are sorry but we are unable to replicate the issue with the latest version 12.1.1. Could you please have a look at the attached sample and let us know if we are missing something in order to replicate the issue.

    Please let us know the spread version you are using so that we may test on the same version.

    Regards

    asyncFunction.zip

  • Posted 26 May 2019, 3:42 am EST

    Hi Sharad,

    Our code looks very much like yours and we can’t figure out what’s happening. So we figured out a way to bypass issue - we load the data, and only afterwards bind the CellChanged events. So everything works.

  • Posted 26 May 2019, 6:10 pm EST

    Hi Daniel,

    We are glad to hear that you were able to resolve the issue and thanks for sharing the solution. But we would like to further investigate the issue for the root cause so could you please share a small sample replicating the issue. That would be really helpful with the investigation.

    Thanks

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels