You need to sign in to do that
Don't have an account?
John Neff
Error: Unknown property 'VisualforceArrayList.name' - How do I solve this?
Hello,
I am trying to group results in a list by a field value, and am getting stuck. I am using this article as a model: http://blog.jeffdouglas.com/2011/03/02/dynamically-group-display-query-results/
Here is my controller:
and here is my vf page:
But I am getting an error when I try to pull in any fields from the Job_Number__c object. Error: Unknown property 'VisualforceArrayList.name'
Can anyone help? Thanks so much in advance!
I am trying to group results in a list by a field value, and am getting stuck. I am using this article as a model: http://blog.jeffdouglas.com/2011/03/02/dynamically-group-display-query-results/
Here is my controller:
public with sharing class SpotController{ public List <Job_Number__c> SPOT {get;set;} public String[] campaigns {get;set;} public void load() { SPOT = [Select id, name, Thumbnail_URL__c, ISCI__c, Title__c, Project__c, Campaign__r.Name from Job_Number__c WHERE Currently_Airing__c = TRUE]; Set<String> campaignSet = new Set<String>(); for (Job_Number__c j : SPOT) campaignSet.add(j.Campaign__r.Name); campaigns = new String[campaignSet.size()]; Integer i = 0; for (String campaign : campaignSet) { campaigns[i] = campaign; i++; } } }But
and here is my vf page:
<apex:page controller="SpotController" action="{!load}"> <html> <apex:repeat value="{!campaigns}" var="campaign"> <apex:pageBlock title="{!campaign}"> <apex:repeat value="{!SPOT}" var="spot"> {!SPOT.name} <apex:outputPanel > </apex:outputPanel> </apex:repeat> </apex:pageBlock> </apex:repeat> </html> </apex:page>
But I am getting an error when I try to pull in any fields from the Job_Number__c object. Error: Unknown property 'VisualforceArrayList.name'
Can anyone help? Thanks so much in advance!
Hi John,
Just Correction you need to change var property for spot collection repeater from spot to spotObj or something else I.E.
Replace To
by doing this your problem will resolve.
Regards,
Chandra Prakash
Happy Coding! :)
All Answers
Change your var pointer name in repeater from Campaign to Camp or something else and then give it a try.
Regards,
Chandra Prakash
Hi John,
Just Correction you need to change var property for spot collection repeater from spot to spotObj or something else I.E.
Replace To
by doing this your problem will resolve.
Regards,
Chandra Prakash
Happy Coding! :)
and place them inside each pageblock table like so:
but I am stuck!
Thanks!
John
Very simple just call campaigns.sort(); in your controller.
Regards,
Chandra Prakash