You need to sign in to do that
Don't have an account?
tdep
Combine Query Selectlist multiple items into 1 value
Hi,
I currently have a for loop inside a Selectlist to gather items within that field. Is there a way to combine multiple values that are the same? So only 1 value shows in the dropdown rather than 2? Is there a way to truncate multiple values into 1?
Example: Change Management is on 2 records in the system but I only want to show 1 on the drop-down/selectList.
Here is the SelectList I am using
public List<SelectOption> getItems() { List<SelectOption> options = new List<SelectOption>(); options.add(new selectOption('', '- None -')); for (Object r : [select FIELDNAME from Object]) { options.add(new selectOption(r.FIELDNAME, r.FIELDNAME)); } return options; }
Thanks in advance
Got it!
All Answers
Is there a way to add an IF statement within the FOR loop to check against the values added? and then do not execute the .add if the value is present?
If so, I am unsure on how to run that test against values that were added. I think this may be the right approach.
Got it!