You need to sign in to do that
Don't have an account?
Varsha Jethwani
how can we do late binding of variable in soql query
for(Contact ThisContact: contactList){ tempGender = ThisContact.Salutation; List<npct1_FC_Gender__mdt> FCGenderList =new List<npct1_FC_Gender__mdt> ([SELECT npct1_Gender_Pick__c, npct1_Addressee_Salutation__c FROM npct1_FC_Gender__mdt WHERE npct1_Gender_Pick__c = :tempGender ]); for(npct1_FC_Building_Block__mdt ThisBuilingBlock :FCBuildingBlockList) { resultString = FCGenderList.get('npct1_Gender_Pick__c') +resultString; // further code } }I know I can't write list in for loop, what would be another way to implement this scenario where I have to pass the variable value in where clause and I have another for loop where I have to retrieve value from that list accordingly to tempGender value.
your code is incomplete, so I don't fully understand what you are trying to achieve, but I using a Set and a Map variables would help you, something like this: Let me know if it helps or you need further guidance.