Show Latest row Entry for a certain user

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:

  1. item
  2. person
  3. 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?

How do you let people “change” the price? Is it via a form or an edit screen?

If it’s an edit, are they editing the same item? What’s your use case for only storing the last change, in that case?

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

1 Like

How is this specific member determined?
For example, is it based on the signed in user? Or maybe the signed in user selects from a list?

In any case, I suspect that you can use a Query column to get what you need.

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

Okay, try this:

  • 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.
1 Like

The single value column was IT!
thank you

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