AnsweredAssumed Answered

FindTask - display parameters when returns no values

Question asked by bridgji on Nov 12, 2013
Latest reply on Nov 12, 2013 by zj_zou
I have an application that reads in a data file does a find task for each item and highlights it on my map.

Its working but I'd like to display the search criteria when I get no results so the user knows.

I'd pop up a message stating that for FID 123 in the parcel layer no parcel was found on the map.

The problem I'm having appears to be a timing issue.

When I hit SelectSIDAsset which is the function that runs after the search the only way I can see to check is the length of results which will be 0.

I thought I'd be able to go back to findParams but by then its on some item farther down the  SIDData.forEach so the data in it is not the one that failed.

I would be happy with either being able to pass the along the findParams so I can review them when there are no results. If I had to wait till each find was complete before kicking off the next would be ok if I had to.
I've attached a code snippet in case it helps.

Thanks
Jim

 
        SIDData.forEach(function (sidData) {
            layerid = GetLayerId(sidData.layername);

            findParams.layerIds = [layerid];
            var xrefield = GISXrefFields[layerid];
            findParams.searchFields = [xrefield];
            findParams.contains = false;
            findParams.searchText = sidData.xrefvalue;
            //      findTask.execute(findParams, showResults, onError);
            findTask.execute(findParams, SelectSIDAsset, onError);
        });


function SelectSIDAsset(results) {
               if (results.length == 0) {
/display

}
           // add not found times
            //findparms

Outcomes