Stream tagged Accounts
A SOQL for loop puts the query right in the loop header.
Your task
Count 201 tagged Accounts in chunks with a SOQL for loop, then run both loop forms on a query with no matches and count the passes.
String tag = 'AS-Q312-' + UserInfo.getUserId() + '-' +
String.valueOf(Datetime.now().getTime());
String tagPrefix = tag + '%';
List<Account> seeded = new List<Account>();
for (Integer i = 1; i <= 201; i++) {
seeded.add(new Account(Name = tag + '-' + i));
}
seeded.add(new Account(Name = 'OTHER-' + tag + '-Decoy'));
insert seeded;
String missingPrefix = tag + '-Missing%';Requirements
- Row count should be computed from the loop
- List-form SOQL loop over
:tagPrefixshould be present - One-row SOQL loop over
:missingPrefixshould be present Rows:should be201Chunks:should be2Empty loop:should be0Empty chunk passes:should be1