-7

I want to get distinct values from the list which contains duplicate values, there are 12 Key value pairs in the list row & I want to check only two key's values, depend on these two keys(PONumber,POCompliant) disctinct values should get.

    [
{
"WR":"234860",
"Pieces":1,
"POCompliant":"YES!",
"PONumber":"SONYAR2435",
"ItemLookupCode":"SO_1_9490410_68",
"Description":"HANS 27495821",
"PriceCheck":"OK!",
"CostCheck":"Item Cost Missing!",
"BarcodeCheck":"10Digit Barcode Missing",
"NegativeQtyCheck":"OK!",
"InactiveCheck":"OK!",
"DoNotOrderCheck":"OK!"
},
{
"WR":"234860",
"Pieces":1,
"POCompliant":"YES!",
"PONumber":"SONYAR2435",
"ItemLookupCode":"SO_1_9490410_69",
"Description":"HANS 06462860",
"PriceCheck":"OK!",
"CostCheck":"Item Cost Missing!",
"BarcodeCheck":"10Digit Barcode Missing",
"NegativeQtyCheck":"OK!",
"InactiveCheck":"OK!",
"DoNotOrderCheck":"OK!"
}]

I did like as per follows but it's not working.

Gson gson = new Gson(); 
ScanWarehouseReceiptResponse[] listArray = gson.fromJson(response.body().getResponseBody().getScanWareh‌​ouseRecieptResponse(‌​).getScanWarehouseRe‌​cieptResult(), ScanWarehouseReceiptResponse[].class); 
    List<ScanWarehouseReceiptResponse> al = new ArrayList<>();
    al.addAll(asList(listArray));
    Set<ScanWarehouseReceiptResponse> hs = new HashSet<>();
    hs.addAll(al);
    al.clear();
    al.addAll(hs);
Nayank
  • 101
  • 1
  • 3
  • 14

1 Answers1

0

Query: SELECT DISTINCT (PONumber,POCompliant) FROM table_name;

Vijay Chaudhary
  • 228
  • 2
  • 12
  • This is the response I am getting from the service, I want to sort client side means on mobile. – Nayank Sep 22 '17 at 06:28