I am building a dashboard for my users but need help.
Each User has 6 six pets.
The dashboard will display specific data points on one of their pets - name, picture etc.
The user will be able to toogle between their 6 pets.
When the user changes the ‘selected pet’ the data points of the specific pet on the dashboard to the selected pet.
If you are storing Pet data as its own data type and linking those to Users what u can do is have a dropdown with a Data Source that searches for that User’s Pets.
Then have a parent group that takes it’s data source from that dropdown’s Pet value. So whatever elements in that parent group will display the appropriate Pet data.
I have a pop-up with a repeating group to switch between a user’s pets.
I am struggling to connect the elements to a users pet - setting a default pet to display when the dashboard page first loads - how to connect the user to the multiple pets etc.
what is the logic to set the search and select any of the users pets?
A work around could be having a data type on the User’s table for active pet. And it would have it’s field type as Pet.
So from the repeating group, there’ll be a workflow to update the current user’s pet.
Event: When Current Cell’s Group is clicked
Action: Make change to a thing → Current User’s Pet.
Then set a custom state on a parent body accessible by all elements on the page.
And set the type of this custom state to pet.
From that parent element, you can access the records of that pet.
Now to the logic of setting the pet on page load
Event: When page loads
Action: Set state of an element to be Current User’s active pet.
In a case where the user hasn’t selected any pet previously, just do a search for current user’s pet and select first item.
Let me know if this helps or if you have any follow up questions.
Quick question as the only issue I have now is in the case when the user hasn’t selected any pet previously - “In a case where the user hasn’t selected any pet previously, just do a search for current user’s pet and select first item.”
Where do I ‘search for current users pet and select first item’?..is it in the workflow section or on the design page with the custom state etc?