How to resolve the error - The value 'null' is not valid for operator '>='
I'm trying a rendered="{!If(Size<4> but I keep getting the following error:
AVALISTA: {!item.contact.Name}
{!item.contact.CPF__c}
END.: {!item.contact.MailingStreet}, CEP: {!item.contact.MailingPostalCode}, {!item.contact.MailingCity}-{!item.contact.MailingState}
Ass: {!item.contact.Procurador_do_Contato__r.Name}
CPF: {!item.contact.Procurador_do_Contato__r.CPF__c}
Controller:
public Integer avalistasSize {get; set;} public List getAvalist(){ if(avalista==null){ avalista=[SELECT Id,contactId, contact.Name,contact.CPF__c,contact.MailingCity,contact.MailingStreet,contact.MailingState, contact.MailingPostalCode, contact.Procurador_do_Contato__r.Name, contact.Procurador_do_Contato__r.CPF__c FROM OpportunityContactRole WHERE OpportunityId =: idOpp ]; } avalistasSize = avalista.size();
To resolve the error - The value 'null' is not valid for operator '>='In your controller (or extension), you do not set a value for avalistasSize until getAvalist() is called.
I don't have any documentation to point to for the order in which merge expressions are processed in Visualforce, but I'd expect that it's the typical "left to right, top to bottom" order. If that is the case, then that can provide an explanation for your error. You use avalistasSize before setting a value
avalistasSize is null
Salesforce complains that you're trying to compare against a null value
You never hit the call to getAvalist() that would set avalistasSize
This can be fixed in more than one way, but the main point here is that you need to ensure that your properties have values before they're used (or as they're used, if lazy loading is appropriate for your scenario).
Given what you've shown us here, I'd probably just recommend turning List avalista into an automatic property, and run the query to populate it (and avalistasSize) in the constructor of your controller/extension.
Bonus:
Things of the form if(, true, false) can be reduced to simplify .
can become