The below code is creating all sequential 4 digits code an is working fine in AnonymousWindow...
string [] a = new string[] {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
string [] b = new string[] {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
string [] c = new string[] {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
string [] d = new string[] {'0','1','2','3','4','5','6','7','8','9'};
for(integer i=0; i<a.size(); i++)
for(integer j=0; j<b.size(); j++)
for(integer k=0; k<c.size(); k++)
for(integer l=0; l<d.size(); l++)
System.debug( a[i] + b[j] + c[k] + d[l]);
System.debug( 'special==> '+a[1] + b[2] + c[3] + d[4]);
System.debug( 'Total==> '+a.size()*b.size()*c.size()*d.size());
Any idea or suggestion will be welcome...
Hi,"the record contains the same attributes": that is the obscure part of the requirement.The only default "counters" of Salesforce are the auto-number fields but they need a new record for each new value.You have just a formula probably to create that will convert the value of the auto-number field of the object into "ABC4" (base 24 (x3) + base 10) but for "the record that contains the same attributes" (?). The formula could be impossible and you need a trigger/process.Otherwise, there is just an object counters__c with fields countrer1__c, counter2__c (trivial) but the problem is the combination of the same attributes once again.