Hi,
I have a table (Product) that stores items, the price, and the person who set the price. Every time the price of an item is changed, the date is also stored. So, every change creates a new row in my Glide Table.
I want to use the table Product to create a table component in my app with the following columns:
item
person
price
And the rows in my table can have repeated items but not the same user for the same item.
For example, this is possible
Apple | Jack | 2$
Apple | Amy | 3$
Banana | Jack | 4$
For example, this is NOT possible
Apple | Jack | 2$
Apple | Jack | 3$
how can I only show the latest price set by the user for an item?
People can set a new price using a custom action - which creates a new row that stores the date, price, name of user, and name of item.
Think of it as a history table in the backlog, Im keeping track of all price changes for all items. But I just want to show users in the frontend the latest price from a specific member
when the row is being added, the user ID is being stored in the row too.
Ive used computed columns to get the user name from the user ID. Same goes for Item ID and Item name.
Ive also used query and lookup to get the latest price a user has set for a certain item.
So now when I am using the data table in my app, I dont want to show rows that have old prices. I want to show the row that is the most recent entry from that user for that item.
so in simple words, every user and item should only appear next to each other in a row ONCE
Create a Query column in the same table that targets the table and uses the following filters:
– User is This Row → User
– Item is This Row → Item
Sort the Query by Date Added in descending order
Add a Single Value column that takes the First → Date Added from the Query column
Now you can filter a collection where Date Added is Single Value Date Added, and this should give you the most recent entry for each combination of Users & Items.