You need to sign in to do that
Don't have an account?
It just me!
Unexpected Token 'FROM'
Hi! Im trying resolve a search issue in opportunity to search records for a particular object custom object. When I press the search I get this error.
I looked at the APEX code and it looks fine using the FROM syntax.
The recordType is "Space". Thanks in advance.
I looked at the APEX code and it looks fine using the FROM syntax.
public void searchSpace2() { try { String spacesSearchQueryString = 'select Id, Name, Term_Months__c, Used__c, from Space2__c where RecordTypeId = :SpaceRecordType and {{condition}}'; String spacesSearchCountQueryString = 'select count() from Space2__c where RecordTypeId = :SpaceRecordType and {{condition}}'; String spacesSearchQueryConditionString = ''; mapHoldingSelectedRecords.clear(); if(spa.Term_Months__c != null) { spacesSearchQueryConditionString += 'Term_Months__c = ' + '\'' + spa.Term_Months__c + '\'' + ' and '; } if(spa.Used__c != null) { spacesSearchQueryConditionString += 'Used__c = ' + '\'' + spa.Used__c + '\'' + ' and '; } if(String.isBlank(spacesSearchQueryConditionString)) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please select the suitable filters to search for pSpaces.')); return; } spacesSearchQueryConditionString = spacesSearchQueryConditionString.removeEnd(' and '); spacesSearchQueryConditionString = spacesSearchQueryConditionString.trim(); spacesSearchQueryString = spacesSearchQueryString.replace('{{condition}}', spacesSearchQueryConditionString + ' order by Name ASC limit ' + QUERY_LIMIT); spacesSearchCountQueryString = spacesSearchCountQueryString.replace('{{condition}}', spacesSearchQueryConditionString); System.debug('------------------- spacesSearchQueryString: ' + spacesSearchQueryString); setController = new ApexPages.StandardSetController(Database.getQueryLocator(spacesSearchQueryString)); setController.setPageSize(PAGE_SIZE); noOfRecords = Database.countQuery(spacesSearchCountQueryString); totalPages = getTotalPages(); populateWrapperList(); } catch(Exception e) { System.debug('------------------- ERROR: ' + e.getStackTraceString()); System.debug('------------------- ERROR MESSAGE: ' + e.getMessage()); ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while searching for pSpaces.' + e.getMessage())); return; } }
The recordType is "Space". Thanks in advance.
should be
There was a comma after Used__c before from (Used__c,)
All Answers
should be
There was a comma after Used__c before from (Used__c,)