You need to sign in to do that
Don't have an account?
Compile Error: Illegal assignment from List <...> to String
Hi Everyone,
I am trying to find how to go about resolving this error. I am new to Apex.
Compile Error: Illegal assignment from List<SurveySelection__c> to String at line 23 column 13
Bottom is my code:
By the way, the data type for "SurveySelection__c" is Number(2,0). I am not sure whether that matters.
-----------------------------------------------------------------------------------------------------------------------------------------------------
public class WrapperDemoController{
public class TableRow{
public String sfsid {get;set;}
public String SurveySelection {get;set;}
}
public List<TableRow> RowList {get; set;}
public WrapperDemoController(){
RowList = new List<TableRow>();
TableRow tr;
for(Student__c con : [SELECT sfsid__c, (select SurveySelection__c from SurveySelections__r) FROM Student__c]){
tr = new TableRow();
tr.sfsid = con.sfsid__c;
tr.SurveySelection = con.SurveySelections__r; // This is line where error occurs
RowList.add(tr);
}
}
}
-----------------------------------------------------------------------------------------------------------------------
Thanks in advance!
Try to update your code like below
Please replace line 23 with below line:
Hope this helps, let me know if you still face the issue.
Thanks,
Gaurav
Thanks for your help. Greatly appreciated.
I tried the code you provided me. I am getting "Invalid type: SurveySelections__c at line 6.."
Can you please check the API name of SurveySelection object. May be same will be SurveySelection__c
Please replace SurveySelections__c with object API name
And let us know if this will help you
What I need to do is: I have a custom object (choices__c) where I'm building a VFP within it. In this VFP I have to query data from another custom object (products__c). I just can't query the data. After that I'll still have to put it in a dropdown list in order for the client to choose the products and start adding it to order.
Can you guys give me some hints?
See below my VF page: See below my choice controller:
So, my list is working fine. When I changed it for the 2 lines in line 5 and 6 in order to query the data in put in the list, I can't get done.