How can I filter my search by maximum availability in a location

I have created a custom record where all the internal ID’s are coming from. However, when I am clicking the button on my NetSuite form it sorts the location alphabetically rather than by which warehouse has the most amount of product. Can I add a search filter to do so?

var uafilters =  new Array();
    uafilters[0] =  new nlobjSearchFilter('custrecord_loc_weigbridge', 'custrecord_wf_ua_weighbridgename', 'anyof', warehousearr);
    uafilters[1] =  new nlobjSearchFilter('formulanumeric', null, 'equalto', '1');
    uafilters[1].setFormula("case when to_date('"+date+"','DD/MM/YYYY') between {custrecord_wf_ua_startdate} and {custrecord_wf_ua_enddate} then 1 else 0 end");
    uafilters[2] =  new nlobjSearchFilter('custrecord_wf_ua_product', null, 'anyof', item);
    uafilters[3] =  new nlobjSearchFilter('isinactive', null, 'is', 'F');

var uacolumns =  new Array();
    uacolumns[0] =  new nlobjSearchColumn('custrecord_loc_weigbridge','custrecord_wf_ua_weighbridgename');
    uacolumns[1] =  new nlobjSearchColumn('custrecord_wf_ua_weighbridgename');
    uacolumns[2] =  new nlobjSearchColumn('custrecord_wf_ua_product');
    uacolumns[3] =  new nlobjSearchColumn('custrecord_wf_ua_startdate');
    uacolumns[4] =  new nlobjSearchColumn('custrecord_wf_ua_starttime');
    uacolumns[5] =  new nlobjSearchColumn('custrecord_wf_ua_enddate');
    uacolumns[6] =  new nlobjSearchColumn('custrecord_wf_ua_endtime');
    uacolumns[7] =  new nlobjSearchColumn('custrecord_wf_ua_bulkproduct');
    uacolumns[8] =  new nlobjSearchColumn('custrecord_wf_ua_bags');

var uaweighbridges = nlapiSearchRecord('customrecord_wf_ua_weighbridges', null, uafilters, uacolumns);

I’m not sure by which column you wanted to sort but you can use the .setSort() method of the column object.

new nlobjSearchColumn('custrecord_wf_ua_bulkproduct').setSort(false /*descending */);