For some reason the variable does not get assigned.
What I am trying to do is to pass a set of ids to VF page from a list button.
Here's my VF code:
<apex:page StandardController="Electricity_Meter__c" extensions="findSupplier" recordSetVar="meters">
<apex:pageblock >
<apex:pageblockTable value="{!ApplicableMeterReturn}" var="Rec">
<apex:column headerValue="Company Name" value="{!Rec.Supplier__r.name}"/>
</apex:pageblockTable>
</apex:pageblock>
</apex:page>
Here's the extension:
public class findSupplier {
Public List<sobject> metersToQuote {get;set;}
public findSupplier(ApexPages.StandardSetController controller) {
mycon = controller;
metersToQuote = mycon.getSelected();
}
ApexPages.StandardSetController mycon;
List<electricity_meter__c> MeterList = [Select id,name,AQ__c,meter_details__c,Profile_Class__c
from electricity_meter__c where (id IN: metersToQuote)];
public list<applicable_meter__c> getApplicableMeterReturn(){
list<Quote__c> oldQuotes = new list<Quote__c>();
list<applicable_meter__c> applicableMeters = new list<applicable_meter__c>();
string supplierQueryString = 'select Supplier__r.name from Applicable_Meter__c ';
string supplierGroupModifier = ' group by Supplier__r.name';
string supplierWhereCondition;
for (sobject meters: MeterList){
if (supplierWhereCondition == null) {
supplierWhereCondition = 'WHERE ';
} else {
supplierWhereCondition += ' OR ';
}
string meterAQ = string.valueOf(meters.get('AQ_C'));
supplierWhereCondition += '(min_aq__c => \'' + meterAQ + '\' ) ';
}
applicableMeters = Database.query(supplierQueryString + supplierWhereCondition + supplierGroupModifier);
return applicableMeters;
}
}
EDIT:
I've pulled the error from the debug log:
15:44:08.088 (88086257)|SOQL_EXECUTE_BEGIN|[8]|Aggregations:0|select id, name, AQ__c, meter_details__c, Profile_Class__c from electricity_meter__c where id IN :tmpVar1
15:44:08.090 (90911470)|EXCEPTION_THROWN|[8]|System.NullPointerException: Attempt to de-reference a null object
tmpVar1
but there is notmpVar1
variable in your code.