1

I am getting this error

: IN operator must be used with an iterable expression at line 16 column 382

public with sharing class Form_Salgsplakat_Bilpris {
 dealer__Vehicle_Inventory__c vi =new dealer__Vehicle_Inventory__c();
 dealer__Deal__c  d=new dealer__Deal__c  ();
 Id dealid;
public dealer__Vehicle_Inventory__c getvi()
{
    return vi;
}

        public Form_Salgsplakat_Bilpris(ApexPages.StandardController controller)
        {
           // Deal id
           d=(dealer__Deal__c  )controller.getRecord();

           // Slect vehicleID from RelatedLook wher deal = "pagId" limit 1;
       vi=[select id,Name,Brand__c,Description_salesprospect__c,dealer__Exterior_Color__c,dealer__Interior_Color__c,dealer__Stock_Number__c,Engine_Displacement_CC__c,Horsepower__c,dealer__Max_Torque__c,Dry_weight_kg__c,Extra_urban__c,CO2_emissions_g_km__c,dealer__Mileage__c from dealer__Vehicle_Inventory__c where id IN:[select dealer__Vehicle__c from dealer__Deal__c where ID IN:d.id] limit 1];
     //   vi=[Select id,Name,Brand__c,Description_salesprospect__c,dealer__Exterior_Color__c,dealer__Interior_Color__c,dealer__Stock_Number__c,Engine_Displacement_CC__c,Horsepower__c,dealer__Max_Torque__c,Dry_weight_kg__c,Extra_urban__c,CO2_emissions_g_km__c,dealer__Mileage__c from dealer__Vehicle_Inventory__c where id IN:[select dealer__Vehicle__c from dealer__Deal__c where id IN:]LIMIT 1];

        }
}

1 Answer 1

2

The problem is that you are ussing In operator in the subquery when you should use = operator.

if you want to get 1 dealer_Deal__C by id you need use = operator. if you get more that 1 you need use IN operator

Example = operator

vi=[select id,Name,Brand__c,Description_salesprospect__c,dealer__Exterior_Color__c,dealer__Interior_Color__c,dealer__Stock_Number__c,Engine_Displacement_CC__c,Horsepower__c,dealer__Max_Torque__c,Dry_weight_kg__c,Extra_urban__c,CO2_emissions_g_km__c,dealer__Mileage__c from dealer__Vehicle_Inventory__c where id IN :[select dealer__Vehicle__c from dealer__Deal__c where ID  = :d.id] limit 1];

Example IN operator

String[] dealerDeals = new String[]{d.Id,d1.Id};
    vi=[select id,Name,Brand__c,Description_salesprospect__c,dealer__Exterior_Color__c,dealer__Interior_Color__c,dealer__Stock_Number__c,Engine_Displacement_CC__c,Horsepower__c,dealer__Max_Torque__c,Dry_weight_kg__c,Extra_urban__c,CO2_emissions_g_km__c,dealer__Mileage__c from dealer__Vehicle_Inventory__c where id IN :[select dealer__Vehicle__c from dealer__Deal__c where ID IN :d.id] limit 1];

You must log in to answer this question.

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