• Matheus Abud
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hello,

I am wondering if it is possible to filter a List of records based on a text field from another Apex List Variable.  I would like the variable parLevelsNeedingStock to grab Par Level records where the field 'Unique_Id_For_Warehouse_Product__c' is not in any of the records from the Apex List<> variable 'tfrs'.   Thanks in advance for any help.
 
        AcctSeedERP__Outbound_Inventory_Movement__c[] tfrs = [SELECT 
                                                                Id, 
                                                                Warehouse_To__c, 
                                                                AcctSeedERP__Warehouse__c, 
                                                                AcctSeedERP__Product__c,
                                                                Lot__c,
                                                                Warehouse_To_and_Product_ID__c 
                                                                FROM 
                                                                AcctSeedERP__Outbound_Inventory_Movement__c 
                                                                WHERE 
                                                                Inventory_Transfer__r.Warehouse_To__r.Category__c = 'Consignment'
                                                                AND
                                                                Inventory_Transfer__r.Transfer_Shipped__c = False
                                                                AND
                                                                AcctSeedERP__Type__c = 'Transfer'];
                                                          
        List<Par_Level__c> parLevelsNeedingStock = [SELECT 
                                                    ID
                                                    FROM 
                                                    Par_Level__c 
                                                    WHERE 
                                                    Unique_Id_For_Warehouse_Product__c 
                                                    NOT IN
                                                    : tfrs
                                                    AND
                                                    Difference_From_Par__c < 0
                                                    AND
                                                    Warehouse_Category__c = 'Consignment'
                                                    ];

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!