146
Views
2
Comments
Making subcategory with entity and records
Question

It's been a while since I worked with Outsystems. I'm working on a mobile warehouse goods application. I want to work with main and subcategories. How do I manage each other in the mobile version of OutSystems?

Example;
Main category;
Mobile phone

Subcategories;
- SIM card
- case
- battery
- screen protector

The ultimate goal is that per main category you will see the associated subcategories in a drop down list. So if you choose mobile phone then you have to be able to choose the subcategories.


2019-12-04 15-28-07
Martijn de Pijper

Hi Ferious,

I am also currently struggling with this situation. 

Is your data model good as in your subcategories are connected with your categories? So that your subcategory entity has "CategoryId" as an attribute? With this you can define which subcategory belongs to which category. 


No I am getting lost with the filtering. If one could help me with this to only show the subcategories that belongs to the selected category I would be very grateful. 


Regards,

Martijn

2019-12-04 15-28-07
Martijn de Pijper

Hi Ferious,

I have got the answer. So when you have your data model as above, then follow these next steps.

1. Create a dropdown for the category (use an aggregate (GetCategories))
2. Create a local variable (Category)
3. Within the properties of the Category Dropdown us the local variable (Category) as the variable.


4. Create a dropdown for the subcategory (also create an aggregate (GetSubcategoriesByCategory.Id)) 

5. Create an extra filter to only select the subcategories that belongs to the concerning category. "Category" in the filter below is the variable. 

6. High five!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.