Ewa.AsyncResult.getReturnValue()

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Remarks
Example

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

var value = Ewa.AsyncResult.getReturnValue();

Return Value

Object

Remarks

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

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

Example

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);    
} 
else 
{ 
    window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false); 
}

// Add event handler for applicationReady event.
function ewaOmPageLoad() 
{         
    Ewa.EwaControl.add_applicationReady(getEwa); 
} 

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

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.");
                break;
            case AsyncErrorCode.TimedOut:
                alert("The operation timed out.");
                break;            
            case AsyncErrorCode.InvalidNamedItem:
                alert("The named item is undefined or unpublished.");
                break;
            case AsyncErrorCode.SettingValuesError:
                alert("Excel Calculation Services is unable to set the values.");
                break;
            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.");
                break;            
        } // 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();
}

</script>

See Also

Reference

Ewa.AsyncResult Methods

Concepts

Ewa Namespace