I am trying to create a chart that dynamically populates the data based on the most recent report ID. For example, if a user generates reports twice, I want my chart to show data points associated with the most recent report. The below is how I structure my database,
Which part are you struggling with? Are you trying to figure out how to grab the ID? Do you not know how to chart the data? Let me know. Hope we can assist.
I don’t know where to apply the filter. Do I need to filter each series’ data source directly? Or, using the conditional tab? Or, a completely different approach?
I don’t know how to exactly set up the logic. I’ve tried :first item and :last item but no luck.
Can you break it down in a few simpler steps? Can you set a state on the page (on page load) that grabs the most recent report_id for them first? Then you have easier access to grab the data you need. Would that work potentially?
I am a total beginner so I haven’t explored many options yet, haha. Interacting with ChatGPT did brought up that that process but it was beyond my current knowledge. I assume you are recommending to set up a custom state on the page. How do I go about that? Can you illustrate the requires steps?
Search for the users latest Report ID and save it to the custom state
Use the state in the search constraints to get your data for the chart
As an alternative, you can also save the recent report id on the user when you create it in the database. Then you don’t need to use a state and can access it directly from the current user.
The challenge here is I don’t have the user’s latest Report ID field readily available within my “User” data type. I am generating a report ID in another platform and sending it along with other data points to my Bubble API endpoint. Can you add more context to how I could automatically append the most recent report ID to the User data type as I receive data?