Hi- I’m trying to set up an expression that captures each person’s latest entry (regardless of when that entry was made). I made a table to make it more visual: Essentially, I want to capture all the red data lines.
The furthest I have gotten is this below. I got the expression to return the latest entry creation date by each person, but I can’t route it back to the actual data.
Another suggestion, could you save this value somewhere else? So then each time you make a change or add that thing into the database, it will update the field that you need? On the user for example. On the user you can have a field called lastestPerformance or something like that. Just a thought. I am sure there are multiple ways to do this. Just the first one that came to my mind.
This is the database structure, so all the social media data are saved (& updated regularly as new entry) under SocialMediaPlatform, and I link the data entry to User as a reference, and vice versa.
Under User, it has a field on which agency they below to, so essentially from an output perspective, I’m first accessing the User database, filtered by their agency, and refer to the SociallMediaPlatform
Hmm I think it should be ok to have the field on the user then. Unless you want to create another dataType to store the data. Does that help? How are they putting in the data? Is it based on a csv upload or are they adding info in Bubble directly with inputs?
i’m using API calls to pull the data, so the reason why i’m using a separate data type SocialMediaPlatform vs. just storing the data in User is the API call will be regularly scheduled to pull/refresh their social media account #'s, so each pull will be its own separate entry (hence the need to find the latest entry per user).
Imo, it’s a cleaner & scalable way to structure the data base, but it complicates a lot on displaying the data on the frontend.
Yeah, each one you pull in you can also save a field onto the user or another dataType so you can easily display it if you want. Each time you refresh the information from the API you can update this field too.
Do you know if there is a cleaner way to do this? Simply because I will likely have 6 different data fields (i.e., 6 metrics) per platform * 4 platforms, so the User will get pretty extensive
I would suggest creating another dataType to handle those fields.
Also, if you use an option set for platform, then you can attach that as well and then you will need less fields. For example:
Metric DataType
Metric 1
Metric 2
Metric 3
Metric 4
Metric 5
Metric 6
Platform
User
Someone else might have a better idea, but this is just one way of doing it.
Both- As in my current socialmediaplatform dataType is what you mentioned in terms of creating a new dataType storing metrics & using option set to store platform values, no?
You can attach the socialMediaPlatform to the Metric DataType instead of making an option set if that makes sense in your app.
For the metrics dataType, I still think you probably need to create something outside of the socialMediaPlatform since it is based on each user. Unless the socialMediaPlatform is unique to each user, then maybe you can use the same thing.