How to create dynamic page displaying assigned discount level based on real sales figures

We are using Knack as portal for our resellers. I was wondering how difficult it was to create a dynamic page with discount levels. In the discount table, I needed to highlight assigned discount level based on real sales figures.

It wasn't so difficult, after all. You can easily follow these steps:

  1. Create a new page
  2. Add table "discount"
  3. Add table "sales figures" with any filtering logic to say what can be included in the discount threshold
  4. put custom javascript code below 
  5. the code finds achieved total sales and then find a discount line with matching the conditions
  6. highlight the discount line
  7. optionally hide the sales table
  8. that's it

Discount page:


User Code (remove comments from the squared line to hide the sales table):





Thanks Michal ...could be very useful