Is there a way to get on a saved search the minimu...
# suitescript
g
Is there a way to get on a saved search the minimum value of any of the on-hand, available, backordered divide by member quantity? I've got a formula however not getting a result... formula is CASE WHEN (MIN(NVL({memberitem.locationquantityonhand}/{memberquantity},0),NVL({memberitem.locationbackordered}/{memberquantity},0),NVL({memberitem.locationquantityavailable}/{memberquantity},0)))
b
you are probably complicating the formula more than you need
you only need to divide the smallest of all 3 quantities by the member quantity
you dont need to do the division 3 times
otherwise, you probably want to use LEAST
g
thanks @battk I had tried least as well however isn't working... LEAST(NVL({memberitem.locationquantityonhand}/{memberquantity},0), NVL({memberitem.locationbackordered}/{memberquantity},0), NVL({memberitem.locationquantityavailable}/{memberquantity},0)) even if I'm trying to get the minimum without the division it isn't populating hence tried min.. LEAST(NVL({memberitem.locationquantityonhand}, 9999999), NVL({memberitem.locationbackordered}, 9999999), NVL({memberitem.locationquantityavailable}, 9999999))
any help to resolve would be greatly appreciated
b
start smaller
get the least of 2 hardcoded numbers
then upgrade to the least of a hardcoded number and locationquantityonhand
then the least of locationquantityonhand and locationbackordered
and then all 3
then add the nvls
finally the division
g
so I've managed LEAST ({memberitem.locationquantityavailable}, {memberitem.locationquantityonhand}, {memberitem.locationquantitybackordered})/{memberquantity} however how can I add nvl and if 0 then populate 0... so for example backordered for this particular item is blank but I would want it to populate 0 in this case...
b
your original solution was to add nvls to every single quantity
same problem as with the division
if any of the quantities is actually null, then thats the least
so use nvl once at the end