Skip to Content

15 - Implement Conditional Formatting to Change Color Based on Data

Amend the shopping cart page - to highlight any items that have a Unit Quantity of 50 or higher – as part of the SAP Build CodeJam.
You will learn
  • How to use a formula to change a row background color.
ithainIan ThainSeptember 29, 2025
Created by
thecodester
May 13, 2024
Contributors
thecodester
neelamegams

Prerequisites

In this exercise, you will be enhancing the Cart page of the SAP Build CodeJam app with data and functionality.

Specifically, you will change the background color of the row showing the cart entries. If the quantity ordered is less than 5 the color will be white, and if it is 5 or more the background color will be changed to amber.

  • Step 1
    1. Open the Cart page.

    2. Select the Row - Items component.

      Row - Cart Item
    3. In the Style tab, click on the Background color, likely set to Home.

      Background color
    4. Select the NEW PALETTE item.

      New Palette Item
    5. Select Formula.

      Edit Formula

      Then click the existing formula, which is just a string representing a color.

      Open formula editor

      Enter the following formula:

      JavaScript
      Copy
      IF(repeated.current.quantity > 4, "#f0ab00", "#f7f7f7")
      
      Edit Formula

      Click Submit, and then save your formula by clicking Convert.

      Edit Formula
    6. Click Save (upper right).

  • Step 2
    1. Open the app again.

    2. Select Notebook Basic 15.

      Keep the quantity as 1 and then click Add to Cart.

      Cart product 1
    3. Go back to the home page, and select ITelO Vault.

      This time change the quantity to 10, and click Add to Cart.

      Cart product 2
    4. Open the Cart page.

      You should see that the ITelO Vault order item is highlighted.

      Cart highlight

    What is the built-in component to which the background color was added?

Back to top