16
Views
8
Comments
Solved
Matching a record to other records based on two attributes

Hi!

After gaining some experience with traditional web apps, I am now developing my first reactive web app and I am struggling with the following issue.

I have a table with personal data, of which the most important ones are name, phone number, hometown and activity preference. I want to iterate over this table to see if a specific record matches any of the other records based on both hometown and activity preference. I then want to store the 'match' in a different entity.

I was hoping someone here has some pointers for me. 


Kind regards,

Shanna

Rank: #2437
Solution

Hi Shanna,

I attached an oml that maybe provides the solution you are searching for? I'm not really sure if I understand the problem correctly.


Kr,


Nick

testCompare.oml

Rank: #288

Hi Shanna 

You can use aggerate or SQL to get records count of which group by the two attributes.

if count > 1, Then it's duplicated.

Kind Regards

Hi Tom, 

thank you for your reply. However, just knowing that it's duplicated is not my end goal. The idea is that its duplicate records are stored in a separate entity so that a person when he/she logs into the application I'm building, will be able to view a table of his/her matches. 

I'm not sure if that can be achieved with the aggregate or SQL of which group by the two attributes?

Kind regards,

Shanna

Rank: #288

Hi Shanna  

Sorry, Maybe because of my poor English skill. I don't understand what do you want to achieve.

Can you share your oml file? Or more detailed information such as data modal(Entity) and some screenshot

Kind Regards

So I have data of the following structure


User1  PhoneNumber1  Hometown1  Preference1

User2  PhoneNumber2  Hometown2  Preference2

.

.

UserN  PhoneNumberN  HometownN  PreferenceN


I then want to take User1 and compare this to all other users based on Hometown and Preference. All records that contain the same hometown and preference I then want to store in a new entity.

Currently, the logic I have is shown in the image. 

Rank: #2437
Solution

Hi Shanna,

I attached an oml that maybe provides the solution you are searching for? I'm not really sure if I understand the problem correctly.


Kr,


Nick

testCompare.oml

Hi Nick, 


thank you for sharing the OML. It's almost the solution I was searching for and I managed to tweak it a bit to solve my problem. Thank you!

Kind regards,

Shanna

Rank: #288

Hi Shanna  

In your action flow attached, Judge by aggerate name is GetUserById, I assumed it only gets one record,

So I don't understand why you need a loop.

If you want to get all duplicated data, As I mentioned before use an Advanced SQL like below.

SELECT User1.* 

from {User} as User1

Inner join

(Select  {User}.[HomeTown],{User}.[Preference] 

    from {User} 

    group by {User}.[HomeTown],{User}.[Preference] 

    having count({User}.[Id]) >1

) as User2

on User1.[HomeTown] =User2.[HomeTown]

and User1.[Preference] =User2.[Preference]


And  if the Maches Entity and User Entity has the same structure,

You can call CreateOrUpdatedMaches action in the loop

Kind Regards

Hi Tom, 

I indeed made a thinking error in the GetUserById. Thank you so much for the SQL solution.

Kind Regards,

Shanna