You need to sign in to do that
Don't have an account?
Christopher Pezza
Convert a deduped List to a Select Options in apex
Ok so I am trying to create a Select List in Visualforce of a list that was just deDuped with this code below:
When I do this the public List<SelectOption> won't let me save i get this Error: "Expression must be a list type: SET<String>" The line is: "options.add" line
public with sharing class CustomerHealth{ Set<String> cmSet = new Set<String>(); public CustomerHealth() { for(Customer_Health__c ch : [SELECT Customer_Success_Manager__c FROM Customer_Health__c WHERE Customer_Success_Manager__c <> ' ']){ cmSet.add(ch.Customer_Success_Manager__c); }//END for }//END public public List<SelectOption> getCSMItems() { List<SelectOption> csmoptions= new List<SelectOption>(); Decimal i; for (i=0; i < cmSet.size(); i++) { options.add(new SelectOption(cmSet[i], cmSet[i])); } return csmoptions; } }//END public with sharing
When I do this the public List<SelectOption> won't let me save i get this Error: "Expression must be a list type: SET<String>" The line is: "options.add" line
This is what im trying to output it in in visualforce:
Help please :)
<apex:selectList size="1" styleClass="btn btn-green btn-xs" value="{!CSMFilter}" onchange="RefreshTable1()"> <apex:selectOption value="{!cmSet}"></apex:selectOption> </apex:selectList>Now i have and actiofunction tied to it but its not relevant, This is before i tried adding the for loop. which i did a get of the deduped list to call that list and output it but i get this error when i do that: "Invalid selectOptions found. Use SelectOption type in Apex."
Help please :)
We Can't Use Set as array So We have to use List instead of Set or We have to itrate set values.
i.e,
Controller----
Vf Page---
Change Select Options Value With csmItems
Regards
Gopal Rathore
All Answers
We Can't Use Set as array So We have to use List instead of Set or We have to itrate set values.
i.e,
Controller----
Vf Page---
Change Select Options Value With csmItems
Regards
Gopal Rathore