Hi I a trying to set a Boolean value in a wrapper based on a condition.
Wrapper Class
public class Wrapper{
public String pf {get; set;}
public Boolean show {get; set;}
public Wrapper (String pf, Boolean show){
this.pf = pf;
this.show = true;
}
}
Controller
List<Wrapper> epf= new List<Wrapper>();
for(String s : << A set of String >>){
Boolean show;
if( << condition >> ){
System.debug('IT CONTAINS '+s);
show = true;
}else{
System.debug('IT DOES NOT CONTAINS '+s);
show = false;
}
epf.add(new entryPortfolioWrapper(s, show));
}
System.debug('CHECK>>'+epf);
In the debug log 'CHECK>>', all the added wrapper objects has 'show' values set 'true' even though there are cases that should be false. Somehow it only takes the default value set in the wrapper class. What am I missing here ?