I have a column that needs to display date if there is no condition else display a combination of text+date if a criteria is met.
I have to append a text Week Of to a date field if a custom field material_group__c in Object1 has certain values N2, A. I want to achieve this only using VISUALFORCE.
Following is what I tried…
ATTEMPT 1
<apex:column title="Estimated Delivery Date at time of Order" rendered="{!OR(p.gew_material_group__c = 'N2', p.material_group__c = 'A')}">
<apex:facet name="header">EDD</apex:facet>
<apex:outputText value="Week Of- {0,date,dd/MM/yyyy}" >
<apex:param value="{!p.planned_ship_date__c}"/>
</apex:outputText>
<apex:outputText value="{0,date,dd/MM/yyyy}" rendered="{!OR(NOT(p.material_group__c = 'N2'), NOT(p.material_group__c = 'A'))}">
<apex:param value="{!p.planned_ship_date__c}"/>
</apex:outputText>
</apex:column>
ERROR 1: Show visualforce codes on column instead of value that is within " " double quotes,
without throwing any errorATTEMPT 2
<apex:column title="Estimated Delivery Date at time of Order">
<apex:facet name="header">EDD</apex:facet>
<apex:outputText value="{!IF(OR(p.material_group__c = 'N2',p.material_group__c = 'L2'),'week of-{0, date, MM'/'d'/'yyyy}','{0, date, MM'/'d'/'yyyy}')}">
<apex:param value="{!p.planned_ship_date__c}" />
</apex:outputText>
ERROR 2: Incorrect parameter type for operator '/'. Expected Number,
received Text
But it seems, i can't have two apex:outputText on the same column. So how should I go about it?
Thanks
Best Answer
Your Attempt 2
There is an error in second attempt. You don't want to enclose '/' within quotes. Please try following - it worked for me:
Your Attempt 1
I wanted to help here as well but I could't find an error in this approach. I copied your example and tried in one of my tables but it was working fine.