You need to sign in to do that
Don't have an account?
Chintha santosh
Getting error like system.QueryException only aggregate expressions use field aliasing
HI,
I'm getting this error like
System.QueryException: only aggregate expressions use field aliasing
public static list<Property__c> getFilteredProperty(string Location,string BedRoom,string BathRoom,string MaxBudget)
{
list<Property__c> allPropertyLists = new list<Property__c>();
string PropertyQuery = 'SELECT Id,Additional_Rooms__c,Available_From__c,Carpet_area_sqft__c,Covered_Area_sqft__c ';
PropertyQuery = PropertyQuery+ 'Electricity_Status__c,Facing__c,Floor__c,For_Bachelor__c,For_Family__c,Furnishing_Available__c,Furnish_Type__c,Geo_Map__c,Landmark__c,Location__c,Area__c,Status__c,State__c,country__c,Maintainance_Charge__c,No_of_Balcony__c,No_of_Bathroom__c,No_of_Bedroom__c,Property_Description__c,Property_Main_Image__c,Property_Owner__c,Property_Video_URL__c,Name,Rent__c,Security_Deposit__c,Verified__c,Water_Availability__c ';
PropertyQuery = PropertyQuery+' FROM Property__c ';
string WhereClause= 'WHERE Rent__c != NULL';
system.debug('*****Location'+Location);
if(string.isNotBlank(Location))
{
if(Location !='ALL')
{
WhereClause=WhereClause+ ' AND Area__c =:Location ';
}
}
system.debug('*****BedRoom'+BedRoom);
integer BedRoomCount;
if(string.isNotBlank(BedRoom))
{
if(BedRoom !='ALL')
{
BedRoomCount=integer.valueOf(BedRoom);
WhereClause=WhereClause+ ' AND No_of_Bedroom__c=:BedRoom ' ;
}
}
system.debug('*****BathRoom'+BathRoom);
integer BathRoomCount;
if(string.isNotBlank(BathRoom))
{
if(BathRoom !='ALL')
{
BathRoomCount=integer.valueOf(BathRoom);
WhereClause=WhereClause+ ' AND No_of_Bathroom__c=:BathRoom ' ;
}
}
system.debug('*****MaxBudget'+MaxBudget);
double MaxBudgetValue;
if(string.isNotBlank(MaxBudget))
{
MaxBudgetValue=double.valueOf(MaxBudget);
WhereClause=WhereClause+ ' AND Rent__c <=:MaxBudget ' ;
}
PropertyQuery=PropertyQuery+' '+WhereClause;
system.debug('PropertyQuery' +PropertyQuery);
allPropertyLists = Database.query(PropertyQuery);
system.debug('PropertyQuery' +allPropertyLists);
return allPropertyLists;
}public static list<Property__c> getFilteredProperty(string Location,string BedRoom,string BathRoom,string MaxBudget)
{
list<Property__c> allPropertyLists = new list<Property__c>();
string PropertyQuery = 'SELECT Id,Additional_Rooms__c,Available_From__c,Carpet_area_sqft__c,Covered_Area_sqft__c ';
PropertyQuery = PropertyQuery+ 'Electricity_Status__c,Facing__c,Floor__c,For_Bachelor__c,For_Family__c,Furnishing_Available__c,Furnish_Type__c,Geo_Map__c,Landmark__c,Location__c,Area__c,Status__c,State__c,country__c,Maintainance_Charge__c,No_of_Balcony__c,No_of_Bathroom__c,No_of_Bedroom__c,Property_Description__c,Property_Main_Image__c,Property_Owner__c,Property_Video_URL__c,Name,Rent__c,Security_Deposit__c,Verified__c,Water_Availability__c ';
PropertyQuery = PropertyQuery+' FROM Property__c ';
string WhereClause= 'WHERE Rent__c != NULL';
system.debug('*****Location'+Location);
if(string.isNotBlank(Location))
{
if(Location !='ALL')
{
WhereClause=WhereClause+ ' AND Area__c =:Location ';
}
}
system.debug('*****BedRoom'+BedRoom);
integer BedRoomCount;
if(string.isNotBlank(BedRoom))
{
if(BedRoom !='ALL')
{
BedRoomCount=integer.valueOf(BedRoom);
WhereClause=WhereClause+ ' AND No_of_Bedroom__c=:BedRoom ' ;
}
}
system.debug('*****BathRoom'+BathRoom);
integer BathRoomCount;
if(string.isNotBlank(BathRoom))
{
if(BathRoom !='ALL')
{
BathRoomCount=integer.valueOf(BathRoom);
WhereClause=WhereClause+ ' AND No_of_Bathroom__c=:BathRoom ' ;
}
}
system.debug('*****MaxBudget'+MaxBudget);
double MaxBudgetValue;
if(string.isNotBlank(MaxBudget))
{
MaxBudgetValue=double.valueOf(MaxBudget);
WhereClause=WhereClause+ ' AND Rent__c <=:MaxBudget ' ;
}
PropertyQuery=PropertyQuery+' '+WhereClause;
system.debug('PropertyQuery' +PropertyQuery);
allPropertyLists = Database.query(PropertyQuery);
system.debug('PropertyQuery' +allPropertyLists);
return allPropertyLists;
}
I'm getting this error like
System.QueryException: only aggregate expressions use field aliasing
public static list<Property__c> getFilteredProperty(string Location,string BedRoom,string BathRoom,string MaxBudget)
{
list<Property__c> allPropertyLists = new list<Property__c>();
string PropertyQuery = 'SELECT Id,Additional_Rooms__c,Available_From__c,Carpet_area_sqft__c,Covered_Area_sqft__c ';
PropertyQuery = PropertyQuery+ 'Electricity_Status__c,Facing__c,Floor__c,For_Bachelor__c,For_Family__c,Furnishing_Available__c,Furnish_Type__c,Geo_Map__c,Landmark__c,Location__c,Area__c,Status__c,State__c,country__c,Maintainance_Charge__c,No_of_Balcony__c,No_of_Bathroom__c,No_of_Bedroom__c,Property_Description__c,Property_Main_Image__c,Property_Owner__c,Property_Video_URL__c,Name,Rent__c,Security_Deposit__c,Verified__c,Water_Availability__c ';
PropertyQuery = PropertyQuery+' FROM Property__c ';
string WhereClause= 'WHERE Rent__c != NULL';
system.debug('*****Location'+Location);
if(string.isNotBlank(Location))
{
if(Location !='ALL')
{
WhereClause=WhereClause+ ' AND Area__c =:Location ';
}
}
system.debug('*****BedRoom'+BedRoom);
integer BedRoomCount;
if(string.isNotBlank(BedRoom))
{
if(BedRoom !='ALL')
{
BedRoomCount=integer.valueOf(BedRoom);
WhereClause=WhereClause+ ' AND No_of_Bedroom__c=:BedRoom ' ;
}
}
system.debug('*****BathRoom'+BathRoom);
integer BathRoomCount;
if(string.isNotBlank(BathRoom))
{
if(BathRoom !='ALL')
{
BathRoomCount=integer.valueOf(BathRoom);
WhereClause=WhereClause+ ' AND No_of_Bathroom__c=:BathRoom ' ;
}
}
system.debug('*****MaxBudget'+MaxBudget);
double MaxBudgetValue;
if(string.isNotBlank(MaxBudget))
{
MaxBudgetValue=double.valueOf(MaxBudget);
WhereClause=WhereClause+ ' AND Rent__c <=:MaxBudget ' ;
}
PropertyQuery=PropertyQuery+' '+WhereClause;
system.debug('PropertyQuery' +PropertyQuery);
allPropertyLists = Database.query(PropertyQuery);
system.debug('PropertyQuery' +allPropertyLists);
return allPropertyLists;
}public static list<Property__c> getFilteredProperty(string Location,string BedRoom,string BathRoom,string MaxBudget)
{
list<Property__c> allPropertyLists = new list<Property__c>();
string PropertyQuery = 'SELECT Id,Additional_Rooms__c,Available_From__c,Carpet_area_sqft__c,Covered_Area_sqft__c ';
PropertyQuery = PropertyQuery+ 'Electricity_Status__c,Facing__c,Floor__c,For_Bachelor__c,For_Family__c,Furnishing_Available__c,Furnish_Type__c,Geo_Map__c,Landmark__c,Location__c,Area__c,Status__c,State__c,country__c,Maintainance_Charge__c,No_of_Balcony__c,No_of_Bathroom__c,No_of_Bedroom__c,Property_Description__c,Property_Main_Image__c,Property_Owner__c,Property_Video_URL__c,Name,Rent__c,Security_Deposit__c,Verified__c,Water_Availability__c ';
PropertyQuery = PropertyQuery+' FROM Property__c ';
string WhereClause= 'WHERE Rent__c != NULL';
system.debug('*****Location'+Location);
if(string.isNotBlank(Location))
{
if(Location !='ALL')
{
WhereClause=WhereClause+ ' AND Area__c =:Location ';
}
}
system.debug('*****BedRoom'+BedRoom);
integer BedRoomCount;
if(string.isNotBlank(BedRoom))
{
if(BedRoom !='ALL')
{
BedRoomCount=integer.valueOf(BedRoom);
WhereClause=WhereClause+ ' AND No_of_Bedroom__c=:BedRoom ' ;
}
}
system.debug('*****BathRoom'+BathRoom);
integer BathRoomCount;
if(string.isNotBlank(BathRoom))
{
if(BathRoom !='ALL')
{
BathRoomCount=integer.valueOf(BathRoom);
WhereClause=WhereClause+ ' AND No_of_Bathroom__c=:BathRoom ' ;
}
}
system.debug('*****MaxBudget'+MaxBudget);
double MaxBudgetValue;
if(string.isNotBlank(MaxBudget))
{
MaxBudgetValue=double.valueOf(MaxBudget);
WhereClause=WhereClause+ ' AND Rent__c <=:MaxBudget ' ;
}
PropertyQuery=PropertyQuery+' '+WhereClause;
system.debug('PropertyQuery' +PropertyQuery);
allPropertyLists = Database.query(PropertyQuery);
system.debug('PropertyQuery' +allPropertyLists);
return allPropertyLists;
}
This is because you are missing a comma in the first line of query string:
string PropertyQuery = 'SELECT Id,Additional_Rooms__c,Available_From__c,Carpet_area_sqft__c,Covered_Area_sqft__c ';
change it to - string PropertyQuery = 'SELECT Id,Additional_Rooms__c,Available_From__c,Carpet_area_sqft__c,Covered_Area_sqft__c,';
You can start by checking online directories or review sites of to find a list of potential candidates. Be sure to read reviews and check their website and portfolio to see examples of their work with this URL: https://www.lgcdecorators.co.uk/our-services/bathroom-fitting-bathroom-renovation/