• Neezen
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Greetings,

 

I am attempting to change the color of text in a visualforce page.  I am doing the logic in the contoller and passing the variable to the VF page.  The problem is I am comparing a lookup field to a set of IDs.  If the ID is not in the list, I want to change the color.  I think I can get there with a nested for loop but it is not best practice.  Any input on how to acheive this is greatly appreciated.

 


public String getcolor1(){
LIST<user> users= new list<user>();
users = [select id, name from user where userrole.name = 'Executive' or userrole.name='Ops Team 8'];
set<id> uid = new set<id>();

for(user us: users){
uid.add(us.id);
}

 

String color='red';
list<carrier__c> Ids = [select id, team__c from carrier__c where team__c != NULL];
//system.debug('***** cid = '+cid);
system.debug('***** uid = '+uid);
system.debug('***** Ids = '+Ids);

for(carrier__c car: ids){
if(car.team__c ! NOT IN: uid){   //  This is incorrect logic.  comparing an ID (lookup field) to a set of IDs.  Perhaps I should have a nested for loop?
color='blue';
}
// }
}
return color;
}

 

 

 

Currently everything in the list is blue and some should be red.

Hi everyone,

 

I also replied here but I want to make sure this gets the attention it deserves as I believe more developers are struggling with this. Since Winter 2014 there has been a shift from using the apex classes tab for testing towards using the Developer Console. This is all well and nice but it is giving me the following issues. 

 

  1. Run all tests and go to the console.
  2. Individual tests show the code coverage for some classes and triggers for that particular test in "Class Code Coverage" window.
  3. "Overall Code Coverage" window however does not show some of these triggers and classes although I can see the the code coverage in the "Class Code Coverage" window.

This is really bad. As developers we need to be able to see full overall code coverage for all triggers and classes without having to calculate this ourselves by performing each individual test and checking what gives the highest coverage.

 

What we need:

  • Being able to see the overall code coverage for ALL classes and triggers.
  • Being able to see which classes have 0% code coverage in the same list as the those that have at least 1% code coverage.
  • Being able to export this list to Excel (by CSV format or whichever is convenient).

There must be more people having the same problem, and if so, how has this been solved ? Currently I do not feel confident I can even make a reliable report with the right test percentages.

 

Thanks.

 

 

 

  • October 29, 2013
  • Like
  • 0

Greetings,

 

I am attempting to change the color of text in a visualforce page.  I am doing the logic in the contoller and passing the variable to the VF page.  The problem is I am comparing a lookup field to a set of IDs.  If the ID is not in the list, I want to change the color.  I think I can get there with a nested for loop but it is not best practice.  Any input on how to acheive this is greatly appreciated.

 


public String getcolor1(){
LIST<user> users= new list<user>();
users = [select id, name from user where userrole.name = 'Executive' or userrole.name='Ops Team 8'];
set<id> uid = new set<id>();

for(user us: users){
uid.add(us.id);
}

 

String color='red';
list<carrier__c> Ids = [select id, team__c from carrier__c where team__c != NULL];
//system.debug('***** cid = '+cid);
system.debug('***** uid = '+uid);
system.debug('***** Ids = '+Ids);

for(carrier__c car: ids){
if(car.team__c ! NOT IN: uid){   //  This is incorrect logic.  comparing an ID (lookup field) to a set of IDs.  Perhaps I should have a nested for loop?
color='blue';
}
// }
}
return color;
}

 

 

 

Currently everything in the list is blue and some should be red.

Hi All,

 

I am having really tough time dealing with Salesforce Test classes.

 

My first problem is when I write a test class, then the class I am testing does not show up in Overall Code Coverage.

 

Then when I click on test the class does show up in Class Code Coverage and show me the coverage % but when I click on it it opens without the colors telling me which line is covered and which is not.

 

 

Please let me know how to resolve this.

 

Thanks.