• Nyjil
  • NEWBIE
  • 5 Points
  • Member since 2011

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

Hi ,

 

I haave a requirement when i populate 3 picklist hierarchical using code. Its working fine but i get duplicates.

 

Example :   xyz

                     xyz

                    abc

 

My code to populate one of the picklist is given below. This gets the elements from a field in the object and i get the value from it by iterating. My issue is i need to eliminate duplicates.

 

      public List<selectOption> getLanguageList() {
     
              List<selectOption> options = new List<selectOption>();
   
         for (List<NKJ_EmailTemp_Classify__c> listMapping : [select Language__c
                                                               from NKJ_EmailTemp_Classify__c 
                                                               where Certificate_Brand__c = :selectedBrand])
                                                            
          {
           for (NKJ_EmailTemp_Classify__c obj:  listMapping) {
               options.add(new selectOption(obj.Language__c, obj.Language__c));
           }
        
          }
            system.debug(options);
            return options ;             
      }

 

Note >> Blue are my custom objects where i select and in the innerloop i iterate over the fields to generate by options list.

  • March 09, 2011
  • Like
  • 0

Hi ,

 

I haave a requirement when i populate 3 picklist hierarchical using code. Its working fine but i get duplicates.

 

Example :   xyz

                     xyz

                    abc

 

My code to populate one of the picklist is given below. This gets the elements from a field in the object and i get the value from it by iterating. My issue is i need to eliminate duplicates.

 

      public List<selectOption> getLanguageList() {
     
              List<selectOption> options = new List<selectOption>();
   
         for (List<NKJ_EmailTemp_Classify__c> listMapping : [select Language__c
                                                               from NKJ_EmailTemp_Classify__c 
                                                               where Certificate_Brand__c = :selectedBrand])
                                                            
          {
           for (NKJ_EmailTemp_Classify__c obj:  listMapping) {
               options.add(new selectOption(obj.Language__c, obj.Language__c));
           }
        
          }
            system.debug(options);
            return options ;             
      }

 

Note >> Blue are my custom objects where i select and in the innerloop i iterate over the fields to generate by options list.

  • March 09, 2011
  • Like
  • 0