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
Dennis PykaDennis Pyka 

Set rendered-attribute with if-statement doesnt work

Hi everyone,

I want to set the rendered attribute of datatable column with an if-statement, depending wether the .Discount variable has a value or not.

I tried the following code, which had absolutly no effect:
<apex:column rendered="{!If(oli.Discount!=null,If((oli.Discount>0),"True","False"),"False")}")" width="10%" headerClass="tableheadercenter" footerClass="tablefootercenter" styleClass="tablebodycenter">
                                <apex:facet name="header">Rabatt</apex:facet>
                                <apex:OutputField value="{!oli.Discount}"/>
                                <apex:facet name="footer"></apex:facet>
                            </apex:column>
Then I tried this code, which also had no effect:
<div style= "display: {!If(oli.Discount != null,'','none') }"
                           <apex:column width="10%" headerClass="tableheadercenter" footerClass="tablefootercenter" styleClass="tablebodycenter">
                                <apex:facet name="header">Rabatt</apex:facet>
                                <apex:OutputField value="{!oli.Discount}"/>
                                <apex:facet name="footer"></apex:facet>
                            </apex:column>  
                           </div>

Does anybody has an idea how such a surely simple statement can be realized? Do I have a syntax issue?
 
AnudeepAnudeep (Salesforce Developers) 
I recommend using {!ISBLANK(oli.Discount)} instead of using null check
Dennis PykaDennis Pyka

Thanks for ypur reply. I tried yout solution but I'm getting the same error again. When I try to render the page the error " incorrect argumenttype for operator '>' occurs. Somehow there must be a issue in this tag:

<apex:column rendered="NOT{!ISBLANK(oli.Discount)}" width="10%" headerClass="tableheadercenter" footerClass="tablefootercenter" styleClass="tablebodycenter">

Is it possible that the error is caused by the Discount field?