cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ericonline
Community Champion
Community Champion

INTERSECTION: Correct syntax for differing schemas?

Hello,

I have two array with different schemas. How do I combine them using INTERSECTION?

Example:

  • Table A:
    • Schema:
      • [
        {
        "KEY": "SUP1|EMP1",
        "territory": "California",
        "location": "SAN BERNARDINO, CA"
        },
        {
        "KEY": "SUP1|EMP2",
        "territory": "California",
        "location": "SAN BERNARDINO, CA"
        },
        {
        "KEY": "SUP1|EMP3",
        "territory": "California",
        "location": "SAN BERNARDINO, CA"
        },
        {
        "KEY": "SUP2|EMP4",
        "territory": "California",
        "location": "SAN BERNARDINO, CA"
        }
        ]
  • Table B:
    •  Schema:
      • [
        {
        "KEY": "SUP1|EMP1"
        },
        {
        "KEY": "SUP1|EMP2"
        },
        {
        "KEY": "SUP1|EMP3"
        },
        {
        "KEY": "SUP2|EMP8"
        }
        ]
  • Goal:
    • [
      {
      "KEY": "SUP1|EMP1"
      },
      {
      "KEY": "SUP1|EMP2"
      },
      {
      "KEY": "SUP1|EMP3"
      }
      ]
  • Code tried so far:
    • Intersection(body('tableA'),body('tableB'))
    • Intersection(body('tableA')?['KEY'],body('tableB')?['KEY'])
    • Intersection(body('tableA')[0]['KEY'],body('tableB')[0]['KEY'])
    • Intersection(outputs('tableA'),outputs('tableB'))
    • Intersection(outputs('tableA')['body']?['KEY'],outputs('tableB')['body']?['KEY'])

None of these work. Any ideas?
Thank yoU!

1 ACCEPTED SOLUTION

Accepted Solutions
v-alzhan-msft
Community Support
Community Support

Hi @ericonline ,

 

I'm afraid that the Intersection function couldn't work with Arrays that have different schemas.

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

2 REPLIES 2
ericonline
Community Champion
Community Champion

Just a heads up @Anonymous , the Forums aren't allowing code in the new code blocks (hence the ugly post). Whenever I put code into a block, whether selecting "HTML/XML" or "JavaScript", it errors out and scrambles everything (very annoying). 

See?: image.png

v-alzhan-msft
Community Support
Community Support

Hi @ericonline ,

 

I'm afraid that the Intersection function couldn't work with Arrays that have different schemas.

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (1,601)