Create a view with a query

Hello,

I have just started learning the Cuba Platform, which is great.
I have the following scenario.
Entities:

  1. Users - Name, Mobile No, email
  2. Committee Master - Start Date, End Date, IsCurrentCommittee
  3. Committee Members - Member (from Users), Designation
  4. Departments - Department Name, Description
  5. DepartmentOwners - Department (from Department),
    Owner (from Committee Member - which comes from Users)

Committee Members are selected from the list of Member Users. A Committee has a defined tenure. So Committee Members change.

So When I try to define Department Owners I need to have the following:

  • Departments
  • Committee Members

I do have them. However there is a problem. From the screen I created using the view, I see all the Committee Members evne those who are not part of the Current Committee.

Is there a way I can define that?

Something like the following:
select users from Users, Committee_Member, CommitteeMaster
where Users is a Committee_Member and
Committee_Member part of currentCommittee

Any help would be greatly appreciated.

Thanks,
Denish

Hi @denishpatel1981,

welcome to the CUBA world :slight_smile: It’s good that you enjoyed it so far.

In order to help you, it would be good if you share an example project, that will show your problem in more detail. Then we can see the screen & view definition.

Bye
Mario

Can you also elaborate on what you mean by “currentCommittee”?

Do you just want to show users who’re on the same committee(s) as the user who is currently logged in?

How do I share an example project?
can you please specify?

Current Committee as the name implies is the current committee.
Similar to say a government.
There is the current government & there may be past governments.
What I want is that I only want to select department / complaint owners from the current committee / government.
I hope that answers your question.

You can run the zipProject gradle task in order to create a zip file of the project.

See: Ответы на вопросы - CUBA.Platform

Attach files with useful information
Do not flood a topic with all the output of your application. Attach additional information like logs and screenshots as files. It is recommended to use GitHub if you want to share a project. Alternatively you can pack a project to ZIP using the built-in zipProject Gradle task and attach it to a topic.

Thanks you for your replies Mario.
Having some issues with the gradle project.
So, am attaching some screenshots.
Let me know if anymore information is needed.

Entities specify the Entities that I have used.
Data, so that explains the situation.

So if you look at the data.
There are 2 Committees

  • First Committee - isCurrentCommittee is false. Has one member
    - Taranjeet Chabbra
  • Elected Committee - isCurrentCommittee is true. Has one member
    - Satish Inamdar

In the ComplaintOwnerSelection pic. I am trying to set an owner for each Complaint Category.
Here when I select the Committee Member, the members need to come only from the Committee which has isCurrentCommittee set to True. (“Elected Committee” in this case).
So, I should only see “Satish Inamdar” in the dropdown.

I hope that explains the situation.

Entities.zip (782.0 KB) Data.zip (110.0 KB)