Hello PowerApps community.
TL:DR - how do you have a form that populates a key-value table with multiple rows per form, with the keys taken from the rows of another table
I'm new to Model Driven Apps, so I have a basic question about how to set forms to work with a common DB arrangement. This is actually an app for COVID but that's both miserable and not something to share publicly, so let's just pretend this question is more humorously about animals at a farm.
We have a form where we fill in the information about a farm - including name, address, and a count of each type of animal by gender. There are a lot of different types of animals, and the animals we ask about may change from week to week.
Given this, rather than setting up a column in a table for each type of animal + gender combination, and changing it constantly, we'd rather pull from a table listing the current animals we are asking about, and ask the user the same question for each animal, storing it in key value pairs.
Here's how we have our dataverse tables
Animal Table - this table might change from week to week, and the animals asked about in the form should change appropriately.
AnimalDesc |
Cow |
Chicken |
Donkey |
Monkey |
Farm Answer Table
FarmId | FarmName | FarmAddress |
1 | Old MacDonald's Farm | E i e i Road |
2 | Wholesome Dairy Incorporated | Bovine Crescent |
Animal Answer Table
FarmId | Animal | Males | Females |
1 | Cow | 2 | 3 |
1 | Chicken | 4 | 5 |
1 | Donkey | 0 | 7 |
1 | Snake | 1 | 2 |
2 | Cow | 3 | 5 |
2 | Chicken | 4 | 7 |
2 | Donkey | 8 | 9 |
2 | Monkey | 0 | 0 |
Form
Farm Details | ||
Farm Name | ||
Farm Address | ||
Animal Count | Male | Female |
Cow | ||
Chicken | ||
Donkey | ||
Monkey |
How do we implement a system like this, where the form fills in one row per farm, but multiple rows for each animal, and generates a field to fill in for each animal in the form?
User | Count |
---|---|
256 | |
107 | |
90 | |
51 | |
44 |