cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jinivthakkar
Resident Rockstar
Resident Rockstar

Compare each row of table with another table and give difference

Hi All,

 

I have a two tables:

Table1: Red, Blue, Green

Table2: Red, Blue, Yellow

 

I need to compare both tables with their index, and create a string. For example table 1 and table 2 both have Red value at index 0 so I need to build the string: "Red" then compare Blue at index 1 and build string as "Red, Blue" and then compare "Green" at index 2 which is a mismatch so the string will be "Red, Blue, <b><font color=blue>Yellow<font></b>"

 

I am then going to use this final html string to be shown on HTML field on the app.

 

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

@jinivthakkar ,

I will give you start on this (I felt like some coding on a Saturday afternoon)- this will get the items in Table2 that are not in Table1 and return it in a comma-separated string - also assumes the field name in both is Value

Clear(colMismatch);
ForAll(
   Split(
      Table1,
      ","
   ) As aMatch,
   Collect(
      colMismatch,
      LookUp(
         Table2,
         !(aMatch.Value in Value)
      )
   )
);
With(
   {
      wSet:
      Concat(
         colMisMatch,
         Value & ","
      )
   },
   Set(
      varMisMatch,
      Left(
         wSet,
         Len(wSet)-1
      )
   )
)	

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
Nogueira1306
Resident Rockstar
Resident Rockstar

Hey!
So why don't you create a flow a condition,2 get items and create a string var. Inside that condition you compare the item from list 1 and list 2
If it is equal, append to the string the name

jinivthakkar
Resident Rockstar
Resident Rockstar

@Nogueira1306 thanks for your suggestion but I need to do this on the app and not on the flow. 

WarrenBelz
Super User III
Super User III

@jinivthakkar ,

I will give you start on this (I felt like some coding on a Saturday afternoon)- this will get the items in Table2 that are not in Table1 and return it in a comma-separated string - also assumes the field name in both is Value

Clear(colMismatch);
ForAll(
   Split(
      Table1,
      ","
   ) As aMatch,
   Collect(
      colMismatch,
      LookUp(
         Table2,
         !(aMatch.Value in Value)
      )
   )
);
With(
   {
      wSet:
      Concat(
         colMisMatch,
         Value & ","
      )
   },
   Set(
      varMisMatch,
      Left(
         wSet,
         Len(wSet)-1
      )
   )
)	

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

jinivthakkar
Resident Rockstar
Resident Rockstar

@WarrenBelz thanks for your time and reply, I will try this and get back to you. Thanks again.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,526)