function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AKallAKall 

debug problem

Hi All,

In the code below I am using the system.assertS to show me which parts of my code are being run. Somehow, the first one is displayed proving that the criteria specified in the if statement is being met, but strangely enough when I comment out the first assert and run the code again the second assert is not being displayed, which indicates that it is not going through the for loop that is controlled by the if statement. I am pretty new to writing code, therefore my debug skills aren't that strong, but this makes absolutely no sense to me. How could it enter the if statement, but not the for loop?

 

 

if(Null != this.selectedTeam) { //system.assert(false,'you made it this far '+this.selectedTeam); for(MeetCompetitors__c M1 : [select ID, Name, Meet__c from MeetCompetitors__c where CompetingTeam__c = :this.selectedTeam]) { system.assert(false,'These are your meets '+M1.Meet__c); filteredMeets.add(M1.Meet__c); }

 

 

 

Anand@SAASAnand@SAAS

If this is an apex class's method then click on the "System Log" link on the top right, and directly execute the method from there. You should see the SOQL being executed and it should tell you if the SOQL returned any rows.

 

PS: System.assert() is really not for "Debugging" but for testing purposes in your test methods. Use "System.debug" instead.