You need to sign in to do that
Don't have an account?
laytro1978
Dynamic date search
Had some help to get to this point but I can't seem to get the code below to work.
Just looking for a list view which will search start dates after the user inputs a date.
The VF page looks okay but I just can't get the controller to work, any help would be great as I am really stuck.
Thanks
Ross
Error: Resmanager Compile Error: Illegal assignment from SObject to SOBJECT:Reservation__c at line 4 column 12
Apex Controller
Made some changes to your code highlighted in red.
public class Resmanager { public Reservation__c reservation {get;set;} public Resmanager(ApexPages.StandardController controller) { reservation=controller.getRecord(); } public List<Reservation__c> getReservations(){ List<Reservation__c> listBd=[select r.id, r.Start_Date__c, R.End_Date__c, nights__c from Reservation__c r where start_date__c = :reservation.Start_Date__c]; return listBd; } public void save() { getReservation(); } }
Visualforce Page
<apex:page standardController="Reservation__c" extensions="Resmanager"> <apex:form > <apex:sectionHeader title="Availability Search"/> <apex:pageBlock title="Search"> <apex:pageBlockButtons > <apex:commandButton action="{!reservation}" value="Search"/> </apex:pageBlockButtons> <apex:inputField value="{!Reservation__c.Start_Date__c}"/> </apex:pageBlock> <apex:pageBlock title="Reservations"> <apex:pageBlockSection > <apex:pageBlockTable value="{!Reservations}" var="res"> <apex:column value="{!res.Start_Date__c}" /> <apex:column value="{!res.End_Date__c}" /> <apex:column value="{!res.Nights__c}" /> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Pretty sure this line
Should be this
All Answers
Pretty sure this line
Should be this
Thanks this and a couple of other changes has got the code working thanks.