You need to sign in to do that
Don't have an account?
Compare two lists of Select Options
Hey there,
I want to create a list of all Objects in my Org and then filter them by my definied List, how can i do this?
So I have created a list of all Objects like this:
public List<SelectOption> getName(){
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
List<SelectOption> options = new List<SelectOption>();
for(Schema.SObjectType f : gd){
options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel()));
}
return options;
}
This actually works fine.
But I'd like to create a filter, so i made this List of Selectoptions:
public List <SelectOption> testObjects = new List <SelectOption>();
public TestOverrideSettingController(ApexPages.StandardController stdController){
testObjects.add(new SelectOption('Event','Event'));
testObjects.add(new SelectOption('Account','Account'));
testObjects.add(new SelectOption('Contact','Contact'));
}
But now I don't know how to go on and compare the Elements in the 2 Lists to each other.
Thanks a lot for every help.
Mx as far as i understood you have two list of select option with you, and you want another list of selctoption, this 3rd selectOption List should contain the option which is comnan in both.
for this we can do something like this
All Answers
I hope I understand correctly what you mean.
There is no Filtration yet, I just created those two Lists of SelectOptions and i want those SelectOptions in the Lists, that are equal in both lists.
Mx as far as i understood you have two list of select option with you, and you want another list of selctoption, this 3rd selectOption List should contain the option which is comnan in both.
for this we can do something like this
this is exactly what i looked for, thank you a lot!