You need to sign in to do that
Don't have an account?
SFDC Dummy
LastDate record Searching
HI
Hi...
I have created a page which will search record date wise...
like i have record
date value
10/9/2015--------------------a
11/9/2015--------------------aa
12/9/2015--------------------aaa
14/9/2015--------------------aaaa
15/9/2015--------------------aaaaa
20/9/2015--------------------aaaaaa
if i am searching record on 10/9/2015 the record will be display 'a'
if i am searching record on 11/9/2015 the record will be display 'aa'
if i am searching record on 13/9/2015 the record will be display 'aa'(12/9/2015 record)
if i am searching record on 14/9/2015 the record will be display 'aaaa'
if i am searching record on 20/9/2015 the record will be display 'aaaaaa'
if i am searching record on 19/9/2015 the record will be display 'aaaaa'(15/9/2015 record)
if there is record on particular date it will display if there is no record on that date it will display last date record
for example i have 10/1/2001 record if i am searching 10/1/2001 it will be displayed 10/1/2001.like this
As per requirment there is no record in 11/1/ 2001 in m object if i am searching 11/1 2001 record it will be display last day record means 10/1/2001...but i am getting
Hi...
I have created a page which will search record date wise...
like i have record
date value
10/9/2015--------------------a
11/9/2015--------------------aa
12/9/2015--------------------aaa
14/9/2015--------------------aaaa
15/9/2015--------------------aaaaa
20/9/2015--------------------aaaaaa
if i am searching record on 10/9/2015 the record will be display 'a'
if i am searching record on 11/9/2015 the record will be display 'aa'
if i am searching record on 13/9/2015 the record will be display 'aa'(12/9/2015 record)
if i am searching record on 14/9/2015 the record will be display 'aaaa'
if i am searching record on 20/9/2015 the record will be display 'aaaaaa'
if i am searching record on 19/9/2015 the record will be display 'aaaaa'(15/9/2015 record)
if there is record on particular date it will display if there is no record on that date it will display last date record
for example i have 10/1/2001 record if i am searching 10/1/2001 it will be displayed 10/1/2001.like this
As per requirment there is no record in 11/1/ 2001 in m object if i am searching 11/1 2001 record it will be display last day record means 10/1/2001...but i am getting
public with sharing class dateInPBTbaleController { public BankBook_Entry__c account{get;set;} public List<BankBook_Entry__c> listAccount {get;set;} //public Date startDate1; //public Date endDat1; public Double totalRevenue {get;set;} public Double totalRevenue1 {get;set;} public Double totalRevenuee {get;set;} public Double totalRevenuee1 {get;set;} public Date dat {get;set;} public dateInPBTbaleController() { listAccount = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c FROM BankBook_Entry__c order by Master_Code1__c ASC ]; } public dateInPBTbaleController(ApexPages.StandardController controller){ account = new BankBook_Entry__c(); totalRevenue = 0; totalRevenue1 = 0; totalRevenuee = 0; totalRevenuee1 = 0; } public void displaingTable(){ if(account.Date__c != null){ listAccount = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c FROM BankBook_Entry__c WHERE Date__c =: account.Date__c order by Master_Code1__c ASC ]; if(listAccount.size() == 0){ listAccount = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c FROM BankBook_Entry__c WHERE Date__c <: account.Date__c order by Master_Code1__c ASC LIMIT 1 ]; } if(account.Date__c == null){ listAccount = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c,LastModified__c FROM BankBook_Entry__c order by Master_Code1__c DESC LIMIT 1]; } } calculateTotalRevenue(); calculateTotalRevenue1(); calculateTotalRevenue2(); } public void calculateTotalRevenue() { for(BankBook_Entry__c acct2 : listAccount) { if(acct2.Bank_Closing_Balance__c!= null) totalRevenuee= acct2.Bank_Closing_Balance__c; } for(BankBook_Entry__c acct : listAccount) { if(acct.Debit__c!= null) totalRevenue+= acct.Debit__c; } totalRevenuee1=totalRevenuee+totalRevenue; } public void calculateTotalRevenue2() { for(BankBook_Entry__c acct2 : listAccount) { if(acct2.Bank_Closing_Balance__c!= null) totalRevenuee= acct2.Bank_Closing_Balance__c; } } public void calculateTotalRevenue1() { for(BankBook_Entry__c acct1 : listAccount) { if(acct1.CB__c!= null) totalRevenue1+= acct1.CB__c; } } } ---------------------------- <apex:page docType="html-5.0" standardController="BankBook_Entry__c" extensions="dateInPBTbaleController"> <apex:define name="body"> <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;"> <apex:form > <apex:pageBlock > <b><apex:outputLabel value="Trial Balance Report On: " style="font-weight: bold;color:red;"/></b> <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/> <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>--> <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;"/><br/><br/><br/> <apex:pageblockTable value="{!listAccount }" var="record" id="tableId" > <apex:column value="{!record.Master_Code1__c}" headerValue="Master Code"/> <apex:column value="{!record.Master_Name__c}" headerValue="Master Name"/> <apex:column value="{!record.Debit__c}" headerValue="Debit(+)" style="color:green;" id="tableId"> <apex:facet name="footer" > <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:green;font-size:12px;height=18px;" > <apex:param value="{!totalRevenuee1}" /> </apex:outputText> </apex:facet> </apex:column> <apex:column value="{!record.CB__c}" headerValue="Credit(-)" style="color:red;"> <apex:facet name="footer" > <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:red;font-size:12px;height=18px;" > <apex:param value="{!totalRevenue1}" /> </apex:outputText> </apex:facet> </apex:column> <td style="background-color: #DAFFFF" ><b> <apex:outputText value="Current Total" /></b></td> <!--- <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;"> <apex:facet name="footer" > <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:green;font-size:12px;height=18px;" > <apex:param value="{!totalRevenuee}" /> </apex:outputText> </apex:facet> </apex:column>--> </apex:pageblockTable> </apex:pageBlock> </apex:form> </div> </apex:define> </apex:page>
Please find your required code below :
Regards,
Abhishek
All Answers
1. based on date= 14-9-2015 (If records found then i need to display records)
2. in case 14-9-2015 records not found (Which records i need to display)
Means, eaither records created on 13-9-2015 only or all records on (13,12,11,10,9,........).
Hi SFDC Dummy,
use isEmpty rather than using NULL.
did you receiving the debug in
in above line.Thanks
D Naveen Rahul.
Please find your required code below :
Regards,
Abhishek