cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alejajurado
New Member

Flow to extract columns from two different lists

Hi!

 

I need help with creating a flow to extract some columns from two separate list and create an item in a third list.

 

All my lists are build with information collected from a MS Form that is linked to my SharePoint site. 

 

My first list is called "codes" and it assigns each person a numeric ID, it collect each person's personal information. My second list is called "hours" and is built by people reporting their working hours in a different MS Form using their numeric ID.

 

I need to build a list that auto-updates every time someone reports their working hours. This new list should extract the fields Code, Campus and Role from the list called "codes" and the fields phone, text and walk from the list called hours. 

 

I have been trying to set up a flow to do that, but I seem not to identify the correct functions or commands... HELP!!!!

3 REPLIES 3
ccc333ab
Solution Sage
Solution Sage

Here is an approach...

 

  1. I'm going to assume that its just people adding rows to your Hours list (not updating). You would kick off this flow with a "When an item is created" and the list you would choose in this trigger is hours list
  2. Then you would use a Get Items action call against your Codes List. However, include a filter query where you would say [ID_From_Codes] eq [ID_From_Hours]   (where [ID_From_Hours] would be an expression grabbing whatever your ID column is in your Hours list...so it would be something like triggerOutputs()?['body/PersonID'].   
  3. Then you would use a Create Item aciton, inclduing Code, Campus and Role from the Get Items (#2 above), and phone, text and walk from the trigger (#1 above).

              Note: #3 will be in an Apply_to_each but assuming you'll only have one ID per person, and the Get Items should only return one entry. 

 

Hopefully that makes sense. 

alejajurado
New Member

Thank you for the answer. I think we are getting there, but it still doesn't work.

 

So my people would first register using one form. The information is stored in a list called Codes. That includes the following columns:

Code

First Name

Last Name

Role

Email

Campus

Phone number

I have a flow set to collect the responses in a list and then send an email with a unique numeric value per person that they will call code from now on.

 

Then, they go to another form to report what they did during the day. That form collects this information:

Code

Campus

Start date

Finish Date

Type of work

Number of hours

 

This information is automatically stored in a list with a flow for collect responses from a form.

 

I tried the option you gave me but I can't see [ID from Hours] in the list of options for the query. Should I first get the response details? 

 

What I am trying to do is basically create different lists to then use them for graphic reports, so that my SharePoint site visitors can see how they are are doing individually, how their campus is doing, how the people in the same position are doing, etc. etc. 

 

Hopefully that's a bit better to understand... Thank you so much!

ccc333ab
Solution Sage
Solution Sage

OK, sorry, my answer wasn't taking into account using forms, was just discussing using lists. Lazy reading on my part. 

 

So this is what I would do for this:

 

1. Trigger When a new response is submitted / Get response dtails I would then make a call to your Codes List, adding a Filter Query to search for the code entered by the user.

 

ccc333ab_1-1625196780141.png

2. I would then check to see if this finds the code. To do this, check to see if any records are returned. 

ccc333ab_2-1625196923468.png

Expression here is: 

 

 

length(body('Get_items')?['value'])

 

 

3. If Yes, then this is where you would use a "Create Item" action to create a new record in the Hours List.

  • You would get dates, type of work and hours from the Get Response Details action
  • You would get name, role, campus from the Get Items action 

Note: Because this is a get Items, it will put this step in a apply_to_each. THat should be OK as codes should only ever have one record for each code created. 

 

4. If No, come up with something to deal with a wrong CODE (if user types it in wrong or doesn't have code). Either email yourself to deal with it, email the user, or whatever makes sense for you.  

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,028)