Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

SOQL: Convert set to list

Asked by Natun Yadav Jul 29, 2021 1.1K views 1 answer
Share

About this question

I am trying to get unique items from an object so I am starting with a set however I need the values to be returned as a list for the visualforce component. I have tried the code below, and variations, but I keep getting errors related to the type not being set correctly. Can anyone help me out? Is there a better way  to convert set to list

and populating a list with unique values from a SOQL query?

public List getItems() { Set license = new Set( [SELECT Name FROM License__c] ); List options = new List(); options.addAll(license); return options; }


Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.