i have some problem in async call of "SDK.REST.retrieveMultipleRecords" function. Below are the code with my Problem
function Main_Method(_AnimalList)
{
new SearchInAnimalRecords(_AnimalList);
}
function SearchInAnimalRecords(_AnimalList)
{
$('#divProgressDetail').append('<br>Start searching Animal Records...');
for (var i = 0; i < _AnimalList.length; i++)
if (_AnimalList[i].SchemaName != "Lion")
this.Process(AnimalSchemaName);
}
SearchInAnimalRecords.prototype.Process = function (AnimalSchemaName)
{
$('#divProgressDetail').append('<br>Retriving ' + AnimalSchemaName + ' Animal Records...');
/// SDK.REST.retrieveMultipleRecords : Sends an asynchronous request to retrieve records.
SDK.REST.retrieveMultipleRecords(AnimalSchemaName, /// The Schema Name of the Entity type record to retrieve.
"$select=" + AnimalSchemaName + "Id", /// A String representing the OData System Query Options to control the data returned
function (AnimalRecords) // "AnimalRecords" only contain 50 records
/// The function that will be passed through and be called for each page of records returned.
/// Each page is 50 records. If you expect that more than one page of records will be returned,
/// this function should loop through the results and push the records into an array outside of the function.
/// Use the OnComplete event handler to know when all the records have been processed.
{
var length = AnimalRecords.length;
for (var i = 0; i < length; i++)
{
var guid = AnimalRecords[i][AnimalSchemaName + 'Id'];
var IsGuidMatch = IsKeyGuidMatchWith(guid);
if (IsGuidMatch)
{
$('#divProgressDetail').append('<br>Key animal found in ' + AnimalSchemaName + ' Records.');
$('#divProgressDetail').append('<br>Searching stop.');
break;
}
}
},
function () /// The function that will be passed through and be called by a failed response.
{
$('#divProgressDetail').append('<br>Error while Retriving ' + AnimalSchemaName + ' Records.');
},
function () /// OnComplete EventHandler The function that will be called when all the requested records have been returned. No parameters are passed to this function.
{
$('#divProgressDetail').append('<br>Completed searching in ' + AnimalSchemaName + ' Records.');
}
);
}
in Process function, their is one anonymous function which accept one parameter named as "AnimalRecords". So problem is this AnimalRecords only contains 50 records, i need here all the records at a time.