1

I have created the following class:

public  class summRes
{
    public Id accountId {get;set;}
    public List<Reservation__c> getres()
    {
        List<Reservation__c> res;
        res = [SELECT Contact__c, ClubID_in_Reservation__c, Name, Arrival_Date__c FROM Reservation__c 
                WHERE  Arrival_Date__c = THIS_YEAR 
                AND Cancellation_Ref__c = NULL 
                AND ClubID_in_Reservation__c != NULL
                AND Hotel_Acct__c = :accountId];
        return res;
    }
}

and now creating the apex:component controller:

<apex:component controller="summRes" access="global">
    <apex:attribute name="AcctId" type="Id" description="Id of the account" assignTo="{!accountId}"/>
    <table border = "2" cellspacing = "5">
        <tr>
            <td>Guest Name</td>
            <td>Club ID</td> 
            <td>Reservation ID</td>
            <td>Arrival Date</td>               
        </tr>
        <apex:repeat value="{!res}" var="r">
        <tr>
            <td>{!r.Contact__c}</td>
            <td>{!r.ClubID_in_Reservation__c}</td> 
            <td>{!r.Name}</td>
            <td>{!r.Arrival_Date__c}</td>             
        </tr>
        </apex:repeat>        
    </table>
</apex:component>

However, I get the following error:

Error: Unknown property 'String.Contact__c'

  • 1
    Error during compile or during runtime? – Eric Sep 6 '16 at 21:36
  • 1
    Looks fine to me. hmmm – Eric Sep 6 '16 at 21:57
  • 1
    Same...seems like it should compile. – Adrian Larson Sep 6 '16 at 22:00
  • 2
    Most likely cause is that you are actually using a version of the summRes class that has this method signature public String getRes(). – Keith C Sep 6 '16 at 22:50
  • 1
    Or maybe you have the following in the controller. public string res { get; set;} – Daniel Ballinger Sep 7 '16 at 3:00
0

Fixed it based on everyones input so big thanks!

Changed the class from summRes to resSum and the again on the component.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.