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
saad mechiche alamisaad mechiche alami 

Visualforce put data in the right column on a table

Hello All, 

User-added image

In the sceen above I need to put a date on 

the lead date column if the stock quantity = 0
the expected ship date  if the stock quantity !=0

the code that I have is not doing that, 

Concerned part in my code:

View:
 
<apex:column >                    
                       <apex:facet name="header">Expected<br>ship date</br></apex:facet> 
                <apex:outputText value="{0,date, dd-MMM-yyyy}" ><apex:param value="{!Stock_date}"  /></apex:outputText>                                      
                    </apex:column> 
                                                      
                    
                      <apex:column >                 
                       <apex:facet name="header">Lead date</apex:facet>
                         <apex:outputText value="{0,date, dd-MMM-yyyy}" ><apex:param value="{!Non_Stock_date}"  /></apex:outputText>                
                    </apex:column>

Controller:
 

if (pl.partLine.Available_stock__c!=0){ 
//in case the stock is different than 0
                        Stock_date=pl.partLine.SVMXC__Expected_Receipt_Date__c;
                        Non_Stock_date=null;
                        }
                        else{
                        Stock_date=null;
                        Non_Stock_date = pl.partLine.SVMXC__Expected_Receipt_Date__c;                        
                        }


I have attached the whole code to this message.
Thanks for your help
Balaji BondarBalaji Bondar
Hi saad mechiche alami,

You have to pass value for each record which will decide whether to show the column based on the condition:
<apex:outputText value="{0,date, dd-MMM-yyyy}" rendered="{!NOT(stockquantity==0)}"  ><apex:param value="{!Non_Stock_date}"  /></apex:outputText>               
<apex:outputText value="{0,date, dd-MMM-yyyy}" rendered="{!(stockquantity==0)}" ><apex:param value="{!Stock_date}"  /></apex:outputText>
Note: change  stockquantity API name based on your code.

Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.