• Fran Korb
  • 10 Points
  • Member since 2017
  • 7Summits

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 0
Which B2B Commerce Global API input parameter or function should I use to retrieve a list of products, ordered by sequence?

I am using version 4.10 of the API
    outputData = ccrz.ccAPIProduct.find(inputData);
where inputData is:
Map<String, Object> initialData = new Map<String, Object> { ccrz.ccApi.API_VERSION => ccrz.ccApi.CURRENT_VERSION, ccrz.ccAPIProduct.PARAM_INCLUDE_PRICING => true, ccrz.ccAPIProduct.PRODUCT_LIMIT => pageSize, ccrz.ccAPIProduct.INCLUDE_COUNT => true, ccrz.ccApi.SIZING => new Map<String, Object> {ccrz.ccAPIProduct.ENTITYNAME => new Map<String, Object>{ccrz.ccApi.SZ_DATA => ccrz.ccApi.SZ_XL}} };
initialData.put(ccrz.ccAPIProduct.PRODUCTSTOREFRONT, storeFont);
initialData.put(ccrz.ccService.ORDERBY, ccrz.ccAPIProductIndex.BY_NAME);
I am trying to build a pick list of countries from the Contact.MailingCountry field in a very large community (200,000+ members).
SOQL does not provide the SQL SELECT DISTINCT statement and there are several alternatives found on the web.
The following query fails with 'Too many query rows: 50001’ :
SELECT n.Member.Contact.MailingCountry c,  COUNT_DISTINCT(n.Member.Id) FROM NetworkMember n WHERE n.Member.IsActive = TRUE GROUP BY n.Member.Contact.MailingCountry LIMIT 50
Is there a better way to build a list of unique entries for a specific field in a large database that is optimized and performant?