Using a DataSet as a return type on an Atlas Javascript WebService call

If the WebService you are calling returns a DataSet it may not be obvious how to get to the data in the returned object.

Here is a little example which may help you on your way..

<script language="javascript">
//<!--
function GetNuugget_OnRequestComplete(result)
{
    var resultsT = result[0];
    var resultRowCount = resultsT.get_length();

    for (var i = 0; i < resultRowCount; i++){
        alert(resultsT.getItem(0).getProperty("Detail"));
        alert(resultsT.getItem(0).getProperty("Creator"));
    }
    
}
//-->
</script>

Notice the DataSet is an array of Table objects. Use the .getItem(rowIndex) method to return the row and the .getProperty(columnName | columnIndex) to access your data.

Author Paul Hayman

Paul is the COO of kwiboo ltd and has more than 20 years IT consultancy experience. He has consulted for a number of blue chip companies and has been exposed to the folowing sectors: Utilities, Telecommunications, Insurance, Media, Investment Banking, Leisure, Legal, CRM, Pharmaceuticals, Interactive Gaming, Mobile Communications, Online Services.

Paul is the COO and co-founder of kwiboo (http://www.kwiboo.com/) and is also the creator of GeekZilla.

Comments

Pablo said:

Thanks for the code!

but it didnt worked for me exactly as in your post, i needed to use:

resultsT.getRow(0).getProperty("ID")

Maybe my Atlas version... dont know

17/Jan/2007 17:31 PM

Add Comment

Name
Comment
 

Your comment has been received and will be shown once it passes moderation.