1

I have a map from which i get the value in visualforce. How do I use the redner condition to check that if the falue is empty it will not render. I get the error:

Incorrect parameter type for function 'not()'. Expected Boolean, received Object

See my visualforce:

  <apex:outputtext rendered="{!IF(!candidateFieldMap != null,true, false)}">
                    <span class="header">motivation</span><br />
                         <cxsrec:getMapValue map="{!candidateFieldMap.PersonalMotivation__c}" key="PersonalMotivation__c" /><br /> 
                    </apex:outputText>
0

Try ISNULL() or ISBLANK() and use capital letters for NOT()

rendered="{!NOT(ISNULL(candidateFieldMap))}"

Or avoid NOT() altogether:

rendered="{!IF(ISNULL(candidateFieldMap),false,true)}"
|improve this answer|||||
  • This returns: Incorrect parameter type for function 'not()'. Expected Boolean, received Object – Thomas Jul 23 '19 at 13:42
  • I edited my answer - try the 2nd one – Brian Miller Jul 23 '19 at 16:39
  • 1
    no reason to use IF -- simpler: rendered="{!NOT(ISNULL(candidateFieldMap))}" - that said testing for null collections in VF is problematic at times without controller support – cropredy Jul 23 '19 at 23:32
0

Try this:

Create a Boolean property in Apex class to check if the map is empty, and use that for rendered tag:

public boolean getIsCandidateMapEmpty() {
    return candidateFieldMap.size() == 0;
}

Then, in vf page:

rendered="{!NOT(IsCandidateMapEmpty)}"

reference: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_functions.htm

|improve this answer|||||
  • This returns: Unknown property 'cxsrec.cxsSmartMap.PersonalMotivation__c' – Thomas Jul 23 '19 at 13:37
  • Sry, u need to check if NOT – salesforce-sas Jul 23 '19 at 13:38
  • This returns: Incorrect parameter type for function 'not()'. Expected Boolean, received Object – Thomas Jul 23 '19 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.