---
title: "Store data and use that data for calculations"
canonical: "https://support.appfire.com/space/SCAFS/477599524/Store%20data%20and%20use%20that%20data%20for%20calculations"
format: markdown
---
> Macro (aura-html)

## Overview

Create a table that can store number data. These numbers can then be used to calculate other values.

## Ingredients

| **App** | Scaffolding |
| --- | --- |
| **Macro** | Table Data, Text Data, Number Data, Evaluate Data |

## Guide

### Step 1 - Create a table

1. Insert a [Table Data](https://appfire.atlassian.net/wiki/x/d5l3H) macro and name it `purchaseTable`.
2. Edit the parameters and set **Initial Rows** as `1`.
3. Create a 4x2 table inside the Table Data macro.
4. Add the following names in the header row:

| **Item** | **Unit Price** | **Quantity** | **Total Price** |
| --- | --- | --- | --- |
|  |  |  |  |

5. Insert a [Text Data](https://appfire.atlassian.net/wiki/x/bpl3H), [Number Data](https://appfire.atlassian.net/wiki/x/jZl3H) and [Evaluate Data](https://appfire.atlassian.net/wiki/x/jZh3H) macro respectively into each table cell under each header as shown:

> Macro (inline-media-image)

  
   
For this example, add the following names for each macro

- Text Data: `item`
- Number Data: `unitPrice`
- Number Data: `quantity`
- Evaluate Data: `totalPrice`

6. Type the following code in the Evaluate Data macro:

```
${unitPrice} * ${quantity}
```

The macro looks as shown:

![image](media://43d55841-c121-4383-b767-3a1759d5cd31)

### Step 2 - Add hidden stored data

1. Create a [Hidden Data](https://appfire.atlassian.net/wiki/x/Dpl3H) macro under the Table Data macro created in the above section.

> ℹ️ The Hidden Data macro is used when you want to enter data to be hidden from the reader of the page.

2. Add two [Number Data](https://appfire.atlassian.net/wiki/x/jZl3H) macros in the Hidden Data macro.
  1. Name them `discount` and `tax`.
  2. Set **Allow Decimal Values **as *true* for both macros as shown:

![image](media://b02e90c1-19a2-48e9-aac0-dab1887da9a3)

### Step 3 - Add calculations

Let’s use Scaffolding to do some math and calculate the following:

- Net Total (excluding tax and discount)
- Discount Amount
- Tax Amount
- Grand Total (including tax and discount)

1. Add four [Evaluate Data](https://appfire.atlassian.net/wiki/x/jZh3H) macros for each of the values above and give them relevant names, as below.  
> Macro (inline-media-image)
2. Enter the following in the **Display Format** properties for each Evaluate Data macro:

```
$ #,##0.00
```

3. Type the following codes into the respective Evaluate Data macros:

- Net Total
- Discount Amount
- Tax Amount
- Grand Total

  
The [Evaluate Data](https://appfire.atlassian.net/wiki/x/jZh3H) macros must look similar to the following image:  
> Macro (inline-media-image)

   


4. **Save** the page
5. Click **Edit Contents** and in the Hidden Data macro:
  1. Input the value `10` for the Discount percentage** **field.
  2. Input the value `0.5` for the Tax percentage** **field.
6. Click **Publish**.

## Result

![image](media://589bf2e0-8fbb-4db1-b1ad-f94011ed638c)