Hey guys I need a little help from some scripting pros.
function getuser(pincode) {
var getusers = web.PostData('https://api.7shifts.com/v1/'+method2+'/','',''+apikey+'','');
var user = JSON.parse(getusers);
for(var i=0; i<user.data.length; i++){
if(user.data[i].user.employee_id == pincode)
return user.data[i].user.id;
}
}
This function is valid… the problem is the data is so huge if it tries to search for something that is way way way down near end it returns undefined. Im guessing its timing out?
Any ideas on how to improve this?
In this case the restaurant has a LOT of employees if I search for an employee that is near end of the list it returns undefined… if I search for one near the start it works fine.