Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Selection or filter issue

(0) ShareShare
ReportReport
Posted on by 419

Hi guys, 

I got some issue on selection statement in grid.

My business context is for some training bootcamp, the training school offer 3 licence level : platinum (highest) - gold (middle) - silver 

Student got to choose many courses, some courses are Platinum, Gold or Silver.

In fact, if student choose one course only in all his choices with Platinum licence level (even the other are all Gold or Silver) the final licence level to pay will be Platinum and so on.

Number | Courses                         | Licence level

1            | Machine Learning         | Gold

2            | Deep Learning              | Platinum

3           | Data analyze                   | Silver

5            | Reinforcement Learning | Platinum

 

The grid will look like this one.

How could i work with select statement or another way to filter to keep only the highest level for each student ?

Thanksfully.

  • Awaxx Profile Picture
    Awaxx 419 on at
    RE: Selection or filter issue

    The option 1 will do the job and its the easiest way for me. Thank you again Martin.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    RE: Selection or filter issue

    I said that this solution is applicable if "values are sorted in the right way". Now you have two options:

    1. Either you can change the enum to support what you need.
    2. Or you can't use such a simple solution and you'll need something more complex. But maybe it won't be that difficult. You never mentioned None before. What is its purpose? Can't you simply exclude it? If you can, you'll add one where condition and that's it.

    Note that I don't understand what problem you have with "i get only ONE course with "Platinum level" i need to give this user the pricing for PLATINUM license even if there's a hundred courses with GOLD or SILVER level". I understand this requirement and I believe that it's what my solution does. Where do you see a problem (apart from the case of None license)? Maybe the key is in your statement "i will have the maximum of a licence appearence in my data", which isn't precise. It'll give you the highest license level for each student.

  • Awaxx Profile Picture
    Awaxx 419 on at
    RE: Selection or filter issue

    Hi goshoom

    To store licence level i got an enum, values are :

    0 None

    1 Platinum

    2 Gold

    3 Silver

    With the maxOf in your example, i will have the maximum of a licence appearence in my data, but in my context it will not works, cause for example if i get only ONE course with "Platinum level" i need to give this user the pricing for PLATINUM license even if there's a hundred courses with GOLD or SILVER level.

    I dont know if i explained it correctly

    Maybe if i count each licence level and look if there 0 or >=1 ?

    Thanksfully.

  • Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    RE: Selection or filter issue

    How do you store Licence level? If it's an enum and values are sorted in the right way, you can simply use maxOf aggreation function.

    For example:

    while select StudentId from studentCourse
    	group by studentCourse.StudentId
    	join maxOf(LicenseLevel) from course
    		where course.Id == studentCourse.CourseId
    {
    }

  • Awaxx Profile Picture
    Awaxx 419 on at
    RE: Selection or filter issue

    hi  AnithaEswaran 

    The bill for the training package will be made on Platinum if only one course with platinum licence is chosen.

    And the same if one Gold courses is chosen, even the other are all silver.

    Regards

  • AnithaEswaran Profile Picture
    AnithaEswaran 2,032 on at
    RE: Selection or filter issue

    hi,

    Do you mean that every student should be assigned only to Platinum by default?

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans