function apiAbort(obj) { writeOutput(serializeJSON(obj)); abort; } if (!structKeyExists(request, "BusinessID") || !isNumeric(request.BusinessID) || request.BusinessID LTE 0) { apiAbort({ OK=false, ERROR="no_business_selected" }); } SELECT lt.lt_Beacon_Businesses_ServicePointID, lt.BeaconID, lt.BusinessID, lt.ServicePointID, lt.lt_Beacon_Businesses_ServicePointNotes, b.BeaconName, b.BeaconUUID, sp.ServicePointName FROM lt_Beacon_Businesses_ServicePoints lt JOIN Beacons b ON b.BeaconID = lt.BeaconID LEFT JOIN ServicePoints sp ON sp.ServicePointID = lt.ServicePointID WHERE lt.BusinessID = ORDER BY b.BeaconName, sp.ServicePointName #serializeJSON({ OK=true, ERROR="", COUNT=arrayLen(assignments), ASSIGNMENTS=assignments })#