You need to sign in to do that
Don't have an account?
TROG
SOQL Variable Naming Rules/Requirements?
Can anyone please tell me if there is a naming convention, or rules/requirements, for naming SOQL variables? It took me FOREVER to try figuring out why my test method wasn't working...throwing an " unexpected token: 'List' " error. I changed the variable name from '1stWR' to 'dupes' and the error went away and it worked. Frustrating. I'd like to learn why so I can at least come away with some education...
****THIS ONE DIDN'T WORK. It threw an "unexpected token: 'List' " error.
// Now we try to find our 1st well revenue, insuring that the "Dupe Well Data" flag for the initial submission is NOT set.
List<Well_Revenue__c> 1stWR = [Select ID from Well_Revenue__c
WHERE Name = :wr1.Name
AND Dupe_Well_Data__c = True
Limit 1
];
System.assertEquals(0, 1stWR.size());
***THIS ONE WORKED, after changing the variable name '1stWR' to 'dupes'.
// Now we try to find our 1st well revenue, insuring that the "Dupe Well Data" flag for the initial submission is NOT set.
List<Well_Revenue__c> dupes = [Select ID from Well_Revenue__c
WHERE Name = :wr1.Name
AND Dupe_Well_Data__c = True
Limit 1
];
System.assertEquals(0, dupes.size());
****THIS ONE DIDN'T WORK. It threw an "unexpected token: 'List' " error.
// Now we try to find our 1st well revenue, insuring that the "Dupe Well Data" flag for the initial submission is NOT set.
List<Well_Revenue__c> 1stWR = [Select ID from Well_Revenue__c
WHERE Name = :wr1.Name
AND Dupe_Well_Data__c = True
Limit 1
];
System.assertEquals(0, 1stWR.size());
***THIS ONE WORKED, after changing the variable name '1stWR' to 'dupes'.
// Now we try to find our 1st well revenue, insuring that the "Dupe Well Data" flag for the initial submission is NOT set.
List<Well_Revenue__c> dupes = [Select ID from Well_Revenue__c
WHERE Name = :wr1.Name
AND Dupe_Well_Data__c = True
Limit 1
];
System.assertEquals(0, dupes.size());
Paul S.
I tried to confirm this and couldn't, but I wonder if it had something to do with the variable name starting with a number...