Compare and Match Data

Hi guys,

Still getting used to Adalo so need a little help getting my head around data processing.

I have two databases. DB1 has NAMES and ID numbers inside. DB2 just has ID numbers.

I would like to get DB2 to query DB1 for ID numbers and pull the correct NAME.

SELECT([DB1 (NAME)], [DB2 (ID)] = [DB1 (ID)])
Select the corresponding name where the ID in DB2 matches DB1, or something along those lines.

Hey there @QIRO

Can you explain in a little bit more detail what youā€™re trying to accomplish?

There is absolutely an easy way to do this, but I just need to understand the process so that I can understand what youā€™re doing in order to provide you with the proper solution.

Hey, sure can!

So my first database contains lots of data points about multiple people. The data weā€™re interested in in this example is their NAME and their ID NUMBER.

The second database will be updated by the appā€™s user and contains anonymised data about those people, showing their ID NUMBER, and not their name.

My aim is to display in the app the data from the second database, but also reference the first database and add the personā€™s name to the screen.

For example:

Database 1
Name: Test Person
ID: 12345

Database 2
ID: 12345
Score: 100%

The app needs to recognise that ID NUMBER 12345 corresponds to ā€˜Test Personā€™ and display:

Name: Test Person (from database 1)
ID: 12345 (from database 2)
Score: 100% (from database 2)

I hope this helps!

Note: The reason this is two databases is that the reports are generated by a third party, so have to be anonymised for data protection. This is not the case once the data is added to the app, as it is to be an internal system.

When you say ā€œdatabaseā€ are you referring to collections or actual databases? Like, do you mean that the first collection in the database is the ā€œUsersā€ collection and the 2nd collection in the database is the ā€œReportsā€ collection? Or is the 2nd ā€œdatabaseā€ an external collection?

If they are both internal collections, you can simply add a custom filter on the list of ā€œDatabase 2ā€ where ā€œReport > ID is equal to Logged in user > IDā€

If the 2nd one is an external collection, youā€™ll need to look at the API reference for your external database to see how to filter by ID.

1 Like

My apologies, they are database collections, both internal to the app as I couldnā€™t find a simple way to integrate the external spreadsheets :pensive:

The ā€œReport > ID is equal to Logged in user > IDā€ isnā€™t referencing the Logged in user, unfortunately. Itā€™s a team of people, only the managers have access to the data. It would need to be something along the lines of Report > ID is equal to Users > ID.

I canā€™t see how to make that connection though, Iā€™m struggling to grapple with the relationships as they donā€™t seem to behave how I expect sometimes :sweat_smile:

The solution:
After re-reading the initial thread (Iā€™ve been reading a ton of them today, had to refresh my memory), I see that you want to use the transporter ID to filter the data. You can certainly do that instead and you wouldnā€™t necessarily need the relationship. Iā€™d still recommend going with the relationship that I mentioned.

Grab ALL of the components within your list and ā€œmake a listā€ so that you have a list nested within a list.

This is how the layers should look:

Set this ā€œList 2ā€ to Drivers > All Drivers with a custom filter where Transporter ID is equal to Current Scorecard > Transporter ID and set the maximum number of items to 1.

Last, edit your name text component and switch that magic text to ā€œCurrent Driver > Associate nameā€

& there it is:

Also, by doing it this way, when you link to another screen with one of the components, you send both the current scorecard and the current driver data to the next screen. For example:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.