21200506
21200506

Reputation: 29

Collect inputs from two separate SharePoint lists and save results in a third list

I'm building an app that has two screens, and these two screens are connected to two separate SharePoint lists.

Screen 1 is connected to the list 'Employees'. In this screen, I have an edit form with various fields related to individual employees, some are text freeform like Name and some are combo boxes (determined by the Sharepoint column's choices). When a user saves the form, it creates a new item in that list. This is what it looks like.

In Screen 2, I have a Container that is connected to the list 'Checklist'. This list is different because it's already filled - each item is a question and these questions have corresponding columns that give more detail about the question. For each question there is also a Yes/No choice column. 

The Container is split into a Gallery on the left, and a view form and edit form on the right (so that the Yes/No choice can be selected). It also has a dropdown list that selects the Names from my first Employees list. After a user completes the checklist and answers Yes or No next to each question, they then click Save. This is what it looks like.

What I want to achieve is: the Save button taking everything from Screen 2 and saving it in a third SharePoint list called 'EmployeeChecklistScores'. I want it to take the employee name selected in the dropdown in Screen 2, but then calculate the Yes/No answers. If Yes then 1, if No then 0.

If the user answered 10 questions with Yes, then after clicking Save I want to have the EmployeeChecklistScores list showing two columns: Name (John Smith in this case) and Total score (10 in this case).

Basically, the purpose of this is to have is a checklist that can be filled out for each employee and then a total score calculated based on that.

Appreciate any advice here.

Edit (re comment below): New save button.

Upvotes: 0

Views: 457

Answers (1)

mmikesy90
mmikesy90

Reputation: 981

After the users submit their data on Screen1, you can refer to the data with Form1.LastSubmit.

PowerApps supports some data type coercing, so you can actually add up booleans:

true + true + false = 2

In your case, I believe Yes/No radio buttons would be better in Screen2 instead of the dropdown. This way, the user has to click anyway. In the OnChange of the radio element you can track their choices as booleans in a collection. You can then use a formula like Sum(MyCollection.BooleanColumn) to calculate the final score.

Also, if you are not planning on storing multiple results per employee, you could consider storing results simply in the first SharePoint list. Best of luck with your project.

Upvotes: 0

Related Questions