This article: Is there a way to do Like against a list of Values?, has a nifty workaround for lack of a LEFT(Column, n) function. I am able to execute a successful code snippet in the anonymous window with the following:

String[] filters = new String[]{'AB1234%','AB2345%','AB3456%'}; 
List<Tools__c> tools = [SELECT ID, Serial_Number__c, Name,Account__r.Name,Product_Family__c FROM 
Tools__c WHERE Serial_Number__c LIKE :filters];

Alternatively I can also swap out the System.Debug(tools); line for:

return tools;

In either case, the debug log has a VARIABLE_ASSIGNMENT event that indicates "List of size 40 too large to display". How can I execute the query and get the entire record set for a report?

  • Not clear on what you are asking, the variable assignment message is just for display in the debug log. If you want the values for the report they will be output just fine.....If you need to output the records in a debug log simply loop through them and debug each one individually
    – Eric
    Dec 6, 2014 at 0:06

1 Answer 1


If you are looking to get this information in a report, you can just create a Report on Tools__c with a filter where you set the operator to 'Contains' and then give the sub-strings you want to search for.

If you are trying to debug each element, I tend to debug them individually as Eric suggested in the comments. I have heard you can use JSON.serialize, which forces the entire object to get thrown into the debug log, but I have not confirmed.

  • you are correct. I was over thinking the solution (I'm so used to writing a T-SQL query for things like this). Just creating a report in the UI with the 'contains' operator captures the records with the sub-strings. Dec 8, 2014 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .