Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Fetching unique elements from one particular column

Posted on by 10

Hi,

I have a table as shown below:

Employee Name Competency Role
Sandya C2 Software Engineer
Devaraj C1 Test Engineer
Prem C3 Test Engineer
Subash C1 Data Engineer
Rushikesh C2 Data Analyst

 

In this table I want all the unique competency as list like ['C1','C2','C3']  

can anyone help me to achieve this task using c# plugin.

Thanks,

Sandya

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Fetching unique elements from one particular column

    Hi Sandya,

    Use the query generated by Fetch Builder with the below function

    public static EntityCollection ExecuteFetch(string fetchXmlString, IOrganizationService service)
            {
                EntityCollection entityCollection = new EntityCollection();
                try
                {
                    entityCollection = service.RetrieveMultiple(new FetchExpression(fetchXmlString));
                }
                catch (Exception)
                {
                    Console.WriteLine("Error from ExecuteFetch");
                }
                return entityCollection;
            }

  • Sandya Profile Picture
    Sandya 10 on at
    RE: Fetching unique elements from one particular column

    Hi   Abdul Wahab,

    I want this in c# plugin because I need to add some more logic on top of it.

    if you can help me on that it would be more helpful

    Thanks,

    Sandya

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Fetching unique elements from one particular column

    Hi Sandya,

    Use Fetch XML Builder to make that query

    pastedimage1676285073939v1.png

    pastedimage1676285096009v2.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans