Last modified: June 08, 2011

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value

Gets the return value of the asynchronous method that was called.

var value = Ewa.AsyncResult.getReturnValue();

The [AsyncResult] object is passed as an argument to the callback specified in the asynchronous method call. The asynchronous method does not return a value directly, but places its return value in the [AsynResult] object. The [AsyncResult.getReturnValue] method gets the return value of the asynchronous operation.

Note Note

The type of the return value depends upon the type returned by the asynchronous operation.

The following code example shows how to get the return value of an asynchronous operation.

<script type="text/javascript">
var ewa = null;
// Add event handler for onload event.
if (window.attachEvent) 
    window.attachEvent("onload", ewaOmPageLoad);    
    window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false); 

// Add event handler for applicationReady event.
function ewaOmPageLoad() 

function getEwa()
    // Get a reference to the Ewa object.
    ewa = Ewa.EwaControl.getInstances().getItem(0);

function getRangeAsync()
    // Get a range asynchronously using A1 notation.
    ewa.getActiveWorkbook().getRangeA1Async("Sheet3!B2", getRangeComplete, null);

function getRangeComplete(asyncResult)
    // If getRangeA1Async failed, get error code.
    if (!asyncResult.getSucceeded())
       // Get the error code.
        var errorCode = asyncResult.getCode();
        switch (errorCode)
            case AsyncErrorCode.InternalError:
                alert("An internal error occurred.");
            case AsyncErrorCode.TimedOut:
                alert("The operation timed out.");
            case AsyncErrorCode.InvalidNamedItem:
                alert("The named item is undefined or unpublished.");
            case AsyncErrorCode.SettingValuesError:
                alert("Excel Calculation Services is unable to set the values.");
            case AsyncErrorCode.RangeSizeError:
                alert("The array indices exceed the range columns and/or rows. Or the range columns and/or rows exceed the array indices.");
        } // End switch.
    } // End if.
    // Get the range object from the getRangeA1Async call.
    var range = asyncResult.getReturnValue();
    // Display the range address in A1 format.
    window.status = range.getAddressA1();