When invoking a service (read operation) is there a way to determine how many records were returned?
I have a page where I am scanning a barcode and then invoking the read service. If the barcode is fetched from the DB my controls are populated with the record info. However, if the barcode does not find a matching record in the DB all my controls on the page say 'undefined'. I would like to trap the results in the service success event and pop an error then clear the undefined.
Will
data.dsXxxx.ttXxxxx.length
do it? My app won't play ball at the moment, so I can't test it, but I think that should work.
Kind of.
If records are actually contained in ttItem then data.dsItem.ttItem.length will return the number of records. If no records are returned I will get the following error.
Uncaught TypeError: Cannot read property 'length' of undefined
If I use if (data.dsItem.ttItem === undefined) then I can trap it.
Thanks.