Base solution for your next web application
Open Closed

group & count #8188


User avatar
0
Siyeza created

I have something that looks like this below.

I want a count of each status something like this below

Active - 5 None-Active - 10 Other - 50

etc...

any help

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Can you provide some simulated data?

    This way I can debug it. :)

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    Siyeza created

    Let me just try and explain. Create an entity call it 'Policy', create another entity call it 'PolicyStatuses'.

    PolicyStatuses

    1. Create
    2. Active
    3. Pending Approval

    Now you have 20 Policies, each policy has a status ie see below

    Now I want to return a List<Policies> grouping statuses and returning the counter StatusName NumberOfOccurances Create 1 Active 3 Pending 2

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    1
    maliming created
    Support Team

    First I think this problem has nothing to do with zero.

    Can you provide simulation data like this? This way I can debug it. :)

    https://www.tutorialsteacher.com/linq/linq-grouping-operator-groupby-tolookup https://stackoverflow.com/questions/7285714/linq-with-groupby-and-count https://stackoverflow.com/questions/38625965/linq-groupby-with-count

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)