You need to sign in to do that
Don't have an account?
Illegal assignment from LIST<SObject> to LIST<String>
Hi ,
Question:is it possiable to store LIST<SObject> to LIST<String>.
bec i am getting following error...
Illegal assignment from LIST<SObject> to LIST<String>.
Why i am tring to pass LIST<SObject> to LIST<String> bec i have to pass to equalsIgnoreCase(Its takeing only string )
following is my code
any help?
public static List<string> searchMovie(string searchTerm)
{
List<string> distinctLastnames = Database.query('Select Project_Name__c from Apartments__c where Project_Name__c like \'%' + String.escapeSingleQuotes(searchTerm) + '%\' ORDER BY Project_Name__c LIMIT 3');
for(string lastname: searchterm){
Boolean found = false;
for(Integer i=0; i< distinctLastnames.size(); i++){
if(lastname.equalsIgnoreCase(distinctLastnames[i]))
{ //Check if current lastname has been added yet
found=true;
break;
}
}
if(!found)
distinctLastnames.add(lastname);
}
return distinctLastnames;
}
Thanks,
jaba
I fear you need to work on the basics a lil bit.
The code has lots of problem in it
Well I guess you need the distinct project names the code should be something like
All Answers
Hi,
Do like this
String soqlQry = 'Select Project_Name__c from Apartments__c where Project_Name__c like \'%' + String.escapeSingleQuotes(searchTerm) + '%\' ORDER BY Project_Name__c LIMIT 3';
List<Apartments__c> apartmentObjList = Database.query(soqlQry);
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
hi Dutta,
Thanks for your reply..
but i am getting following error when i pass the apartmentObjList list to equalsIgnoreCase
Method does not exist or incorrect signature: [String].equalsIgnoreCase(SOBJECT:Apartments__c)..
I fear you need to work on the basics a lil bit.
The code has lots of problem in it
Well I guess you need the distinct project names the code should be something like
Thank you Avi...Will Work On BAsic..