0

Here is my controller class

public PageReference find() 
{         
    lstResultWrapper = new List<ResultWrapper>();
    for(Account c : [SELECT BillingCountry, Industry, (SELECT Id, Name,Amount , StageName FROM Opportunities) FROM Account WHERE BillingCountry = 'USA'])
    {
            ResultWrapper result = new ResultWrapper(c,c.Opportunities);
            lstResultWrapper.add(result);                
            system.debug('=============lstResultWrapper================='+lstResultWrapper);

    }

    return null;
}     

public class ResultWrapper{

    public Account account {get;set;}
    public Opportunity opportunity {get;set;}

    public ResultWrapper(Account acc,Opportunity opt)
    {
        this.account = acc;
        this.opportunity = opt;
    }
}

Here is my VF page

<apex:pageBlock id="tableId2">
                <apex:pageBlockTable value="{!lstResultWrapper}" var="items" id="table">
                    <apex:column headerValue="Industry"> 
                    <apex:outputText value="{!items.account}"/> 
                    </apex:column> 

                    <apex:column headerValue="Country"> 
                    <apex:outputText value=""/> 
                    </apex:column> 

                    <apex:column headerValue="Description"> 
                    <apex:outputText value=""/> 
                    </apex:column> 
                </apex:pageBlockTable>                             
            </apex:pageBlock>    

Edit :

im using aside.io for writing code.So when im trying to save the code its return this error
Thanks in advance

7
  • Can we see the entire controller? Make sure lstResultWrapper is defined as public. Also, you may want to use one of the account's properties, not the account itself. For example {!items.account.Industry} Mar 11, 2016 at 19:45
  • whole class is so big.yes lstResultWrapper is public
    – moin khan
    Mar 11, 2016 at 19:47
  • Did you try using one of the account's properties instead? Mar 11, 2016 at 19:48
  • no ive try to use the account's properties instead yet
    – moin khan
    Mar 11, 2016 at 19:53
  • Please try and let us know Mar 11, 2016 at 19:53

1 Answer 1

2

Just a hunch, but you might try changing the names of the wrapper properties. In general, it's bad practice to give properties the same name as their data types as Apex is case-insensitive, and I've occasionally seen that lead to bizarre behavior like this because the parser isn't sure how to properly dereference your expressions.

Also, try binding {!items.theAccount.Name} to your apex:outputText, because it probably doesn't like having an entire sObject bound to an output usually intended for a single field or string.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .