Calculating and displaying a value based on which inline filter option is selected

Is it possible to calculate a value to display in a table based on how data in a table is filtered by an inline filter?

The inline filter would be based on linked records. The calculated value would change depending on the linked record chosen in the filter.

This would be using Airtable as the data source. The calculated value would only exist temporarily for display in Stacker, it would not be written back to Airtable.

The use case is displaying a table of products with their prices:

  • A subset of products can be purchased by different stockists (hence each product record is linked to one or more stockist records), and each stockist has a different discount (so each stockist record contains a number field with their discount amount).

  • The stockist field is enabled as an inline filter.

  • When selecting a stockist as the filter option a discounted price field is displayed based on the list price in the product record multiplied by the discount level in the stockist record.

Any suggestions are welcome!
Thanks!

Hey Jack,
Off the cuff, I would say that the calculation wouldn’t be made until the product is connected to the stockist, therefore neither Airtable or Stacker would know what discount to make visible …

However, if your discount is connected to a category of stockists, then you could create a calculation field in your product table based on that category. Once you do that, then assign your stockist that category, and then you can use a conditional visibility to choose which calculation field to show based on the category of the logged-in stockist.

Hope that makes sense. If not, feel free to reach out again. :v:

Thanks @MrLunt, this is a great suggestion, I will play around and see if it helps. It might get me closer to a solution.

The challenge I have is the the logged in user would be an internal staff member, who manages multiple external stockists. External stockists do not log in. So I can’t use the user to determine which discount to use.

Gotcha,
So, in that case, you’d have to create a field in the Product table for every discount rate. If you did that, you could then create multiple views in Stacker showing the discounted field in the table associated with that view’s name.

Hope that helps too. :+1:

Yes - that is what I ended up doing. Not quite what I was aiming for but I can make it work this way. Thanks a lot for your help!