Hi, I wonder if its possible to ORDER BY absolute values in a storage system query. The code I have been trying to use is:
return Storage.system.findItem("WHERE SKU IS $1 AND Item.item.ExpiryDate IS $3 ORDER BY ABS($2-Item.slot.storageObject.zone) ASC", 0, token.SKU, Zone, expDate);
SKU is an indexed item label, ExpiryDate is an item label, but not indexed, zone is a label on storage racks.
This code gives these error messages:
Compiler Console:
Invalid sql function ABS
System Console:
exception: FlexScript exception: Invalid query int Storage.System.querySlots() at <no path> c: <no path> i: <no path>
I have also tried replacing ABS() with Math.fabs(), but this just returns different error messages.
Am I doing something wrong, or is there some other workaround to ORDER BY absolute values in a storage system query?
By some googling I know ORDER BY ABS() is supported in normal SQL queries.
The reason for trying to ORDER BY absolute values, is I want to find an item in the closest zone to $2 Zone. The zone label is an integer label with values from 1-18.