web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : qB2GmDn3CblptNK2VddfGZ
Power Automate - Building Flows
Answered

Compare Two Entities, Write New Records

Like (0) ShareShare
ReportReport
Posted on 23 Jun 2020 20:03:35 by 1,104

Hi,

I have employee data on Training Courses in CDS entities. I want a Flow that triggers when the Position lookup on Employee is changed. I want it to compare the Position Requirements entity for the new Position with the current Details entity for the employee to see which new courses are needed. So an employee has 4 courses, the new position needs 6 courses, 4 of which carry over from the old position, so the 2 additional courses need to be created as outstanding records in the employee Details.

 

I tried listing the Position Requirements for the new position and listing the Employee Details for the employee. Then I created a condition that says "If Course in 'list requirements' is equal to Course in 'list details' then Create New Details record."

Annotation 2020-06-23 135637.png

Annotation 2020-06-23 135930.png

 

The problem is that this is double counting. So I have an employee with details on 4 Courses. Her new position has requirements for 6 courses, 4 of which she already has. With the Flow as I have it now, it creates 24 Details records. What it should do is keep the original 4 Details records and create 2 new ones for the courses she doesn't have.

 

Does that make sense? Please help me out with this one, it's been a real problem for me.

 

Thank you

I have the same question (0)
  • SeanHenderson Profile Picture
    1,104 on 25 Jun 2020 at 16:50:22
    Re: Compare Two Entities, Write New Records

    Course is the common field.

    I was able to get it to work with a little effort, thank you for your help!

  • MJain Profile Picture
    2,450 on 24 Jun 2020 at 21:22:29
    Re: Compare Two Entities, Write New Records

    Hi @SeanHenderson ,

     

    In Apply to each loop input should be Training Requirements and there is no need to use inner loop for filtering. Use Filter array and use Current Training and then filter based on course which is what you have done . 

     

    If you do not have common field how are you comparing then ?

     

    Thanks

  • SeanHenderson Profile Picture
    1,104 on 24 Jun 2020 at 21:10:59
    Re: Compare Two Entities, Write New Records

    Step 3 is what I'm struggling to understand. 

    Bear in mind, the two entities I'm comparing, Training Details and Training Requirements, are totally different entities. They only share a single common column, called Course. It's the Course values that are in one and not the other that I want to extract.

    Where in your filter array does it compare the two Course columns?

  • MJain Profile Picture
    2,450 on 24 Jun 2020 at 18:56:33
    Re: Compare Two Entities, Write New Records

    Hi,

     

    Here are the steps which I have done for your example: , to make it simple I have declared two arrays containing 1,2,3,4 and 1,2,3,4,5,6 values in these.

     

    1.JPG2.JPG

    Capture.JPG

     

    Thanks

  • SeanHenderson Profile Picture
    1,104 on 24 Jun 2020 at 18:12:56
    Re: Compare Two Entities, Write New Records

    I'm having trouble following your steps, I haven't worked with arrays much before. Can you please show me an example?

  • Verified answer
    MJain Profile Picture
    2,450 on 23 Jun 2020 at 21:18:44
    Re: Compare Two Entities, Write New Records

    Hi @SeanHenderson ,

     

    Please use following steps :

    1. Create a blank array to hold values which do not match 

    2. Use Apply to each loop and select either of value items as input. 

    3. Inside the Apply to each add filter array and add another value as input.

    4. Use condition to check if the filter array returned result , if value is returned do nothing else add this column id to array created in step 1. 

    5. Now the array contains values which are new , so use Apply to each loop and use this array as input 

    6. Filter second array ( containing 6 values) with value and use the output of this filter array body to insert new record.

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading started
Loading complete