function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

how to use .getvalues with map nd display the picklist value from custom setting on VF apge

have a custom setting called product and under that i created two fields called and other is string field BD__c. i want to display picklist value based on string matching record. my custom setting looks like
AAA |1,2,6,8|| common for all
BBB |1,2,6,8
NNN|8 || only when BD is 8 
CCC| 1,2,6|| only when BD is 1,2,6
public List < SelectOption > getTR_picklistvalue() {
    system.debug('******Start of getTR_picklistvalue');
    List < SelectOption > options = new List < SelectOption > ();
    options.add(new SelectOption('', '--Select--'));
    Map < String, picklistvalue__c > Prod = picklistvalue__c.getAll();
    List < String > keys = new List < String > (Prod.keySet());
    for (String key: keys) {
        if (Prod.get(Key).BD__c == '1,2,6,8')
            Options.add(new SelectOption(Prod.get(Key).picklistvalue__c, Prod.get(Key).Name));
            Options.add(new SelectOption(Prod.get(Key).picklistvalue__c, Prod.get(Key).Name));
    return options;


so my requirmet is to display AAA BBB CCC and DDD when BD is 1,2 or 6,
and Display NNN,AAA,BBB when  it is 1or 2,6.
so when string value is 1,2,6,8 it should show AAA, BBB when its 8 it should show NNN, but i can see all the values even if BD__c==8
Here is my apex contoller method. can someone suggest me what i am missing Or can someone just help me how to diaply values on controller based on other field value