After creating the Sobject below, I'm trying to create 3 sets, 1 for YearNumber, Scheduled_Days and MonthNumber to use in a query. I need these 3 sets to be of Integer/String type so I must dereference the SObject field first. I would appreciate help in writing this as it seems as if it should be easy but I've not been doing it right and getting syntax errors.
List schconnList = [select id, Address_Type__c, Address_Type_r.Provider_c, Address_Type_r.Address_c,Schedule_Development__r.Scheduled_Days__c, Schedule_Development_r.YearNumber_c, Schedule_Development_r.MonthNumber_c, Schedule_Development__r.Start_Time__c, Schedule_Development__r.End_Time__c from Schedule_Connection__c where Id in:schconnections];
Set MonthNumber
Set Scheduled_Days
Set YearNumber
Note: I'm creating 3 Sets to later do a query against another Custom Setting using these values. Currently it's querying the entire recordset of this object = BAD so I'm trying to limit this query by using these Sets.
Can I use List to add all items to set in SOQL without loop similar to:
Set yearList = New Set ( [select Schedule_Development_r.YearNumber_c from Schedule_Connection__c where Id in:schconnList].Schedule_Development_r.YearNumber_c.intvalue());