Simple Database and Applications
In this lab exercise, you will create a simple e-commerce database and applications using Google AppSheet.
Create the Database
- Sign in the Google account that you want to use for this exercise.
- Go to Google AppSheet.
- Go to "Create | Database | New database".
- If this is your first time using AppShet:
- Click the "Get Started" button.
- Click through the tutorial, if you like.
- Click on "+ Add column".
- For "Name", enter "Email".
- For "Type", choose "Email".
- Click on the "Save" button.
- Click on "+ Add column".
- For "Name", enter "Quantity".
- For "Type", choose "Number".
- Click on the "Save" button.
- Click on "+ Add column".
- For "Name", enter "Colour".
- For "Type", choose "Color".
- Check all the colours.
- Click on the "Save" button.
- Click on "+ Add column".
- For "Name", enter "Item".
- For "Type", choose "Enum".
- Click on the "Add value" button.
- Enter "Plate".
- Click on the "Add value" button.
- Enter "Bowl".
- Click on the "Add value" button.
- Enter "Cup".
- Uncheck "Allow other values".
- Click on the "Save" button.
- Drag the existing "Status" column to the very end.
- Click the 3 dots next to the "Assignee" column and choose "Delete column".
- Delete the "Date" column.
- Click the 3 dots next to the "Email" column and choose "Use column as label".
- Delete the "Title" column.
- Right-click just to the left of "1" for row 1 and choose "Delete row".
- Delete the other 3 rows.
- Click the 3 dots next to "Table 1" and choose "Table settings".
- Change the table name to "Order".
- Click on the "Save" button.
- Click inside "Untitled database".
- Change the database name to "Store".
- Click on the main AppSheet icon.
Create the Order Application
- Go to "Create | App | Start with existing data".
- For "App name", enter "New Order".
- For "Category", choose "Other".
- Click the "Choose your data" button.
- Choose "AppSheet Database".
- Choose "Store".
- We only want this app to add new order records, so uncheck "Update" and "Delete" to the right of "Order".
- Confirm that only "Add" shows to the right of "Order".
- Click on the "Create app" button.
- Click on the "Customize with AppSheet" button.
- Click on the "Views" icon on the far left toolbar (it looks like a little mobile phone).
- Under "View type", choose "form". This becuase we want to present a fill-out form by default to the customer.
- Under "Finish view" choose "Order_Detail". This will summarize the order for the customer.
Customize the Email field
- Hover over the "Email" field in the app preview. Click on the edit icon (looks like a little pencil). Choose "Edit Column".
- Expand the "Data Validity" section.
- Check the "Require?" checkbox.
- Expand the "Auto Compute" section.
- Click inside the "Initial value" field area.
- Choose the "Other" tab.
- Way over to the far right of the "USEREMAIL()" pattern, choose "Insert".
- Click on the "Save" button.
- Expand the "Update Behavior" section.
- Uncheck "Editable?". We just want to fill in the email field with the customer's logged in email. We don't want them to change it.
- Scroll to the top of the dialog box.
- Click the "Done" button at the top right.
Customize the Quantity field
- Hover over the "Quantity" field in the app preview. Click on the edit icon (looks like a little pencil). Choose "Edit Column".
- For "Maximum value" enter "10".
- For "Minimum value" enter "1".
- For "Increase/decrease step" enter "1".
- Expand the "Data Validity" section.
- Check the "Require?" checkbox.
- Expand the "Auto Compute" section.
- Click inside the "Initial value" field area.
- In the "Enter an expression" area, enter "1" (no quotes).
- Click on the "Save" button.
- Scroll to the top of the dialog box.
- Click the "Done" button at the top right.
Customize the Colour field
- Hover over the "Colour" field in the app preview. Click on the edit icon (looks like a little pencil). Choose "Edit Column".
- Expand the "Data Validity" section.
- Check the "Require?" checkbox.
- Expand the "Auto Compute" section.
- Click inside the "Initial value" field area.
- In the "Enter an expression" area, enter "Red" (yes, include the quotes here).
- Click on the "Save" button.
- Scroll to the top of the dialog box.
- Click the "Done" button at the top right.
Customize the Item field
- Hover over the "Item" field in the app preview. Click on the edit icon (looks like a little pencil). Choose "Edit Column".
- Expand the "Data Validity" section.
- Check the "Require?" checkbox.
- Expand the "Auto Compute" section.
- Click inside the "Initial value" field area.
- In the "Enter an expression" area, enter "Plate" (yes, include the quotes here).
- Click on the "Save" button.
- Scroll to the top of the dialog box.
- Click the "Done" button at the top right.
Customize the Status field
- Hover over the "Status" field in the app preview. Click on the edit icon (looks like a little pencil). Choose "Edit Column".
- Expand the "Data Validity" section.
- Check the "Require?" checkbox.
- Expand the "Auto Compute" section.
- Click inside the "Initial value" field area.
- In the "Enter an expression" area, enter "Not Started" (yes, include the quotes here).
- Click on the "Save" button.
- Expand the "Update Behavior" section.
- Uncheck "Editable?". The initial status for an order is always "Not Started" and we don't want the customer to be able to change it.
- Scroll to the top of the dialog box.
- Click the "Done" button at the top right.
Finishing up the App
- Click the big "SAVE" button at the top right to save your changes so far.
- In the toolbar on the far left, click on the "Data" icon (the one just above the "Views" icon).
- For the "Status" field, uncheck the "Show?" attribute. The customer doesn't need to see this field.
- In the toolbar on the far left, click on the "Settings" icon (looks like a gear).
- Under "App Properties" turn on the "Personal use only?" setting.
- Click the big "SAVE" button at the top right to save your changes.
Deploying the App
- In the toolbar on the far left, click on the "Deploy" icon (looks like a rocket).
- Click "Deployment Check".
- Scroll down. It looks like there is an error. You can click the "ERROR" button to see the details. For personal use apps, this is not a problem.
- Click the "Move app to deployed state despite errors" button.
Running the App
- In the toolbar at the top, click on the "Share" icon (looks like a "+" sign next to a head-and-shoulders icon).
- Click on "Copy sharing links" and copy "Browser Link".
- In a new browser tab, paste the link.
- Click on "Save" to place the first order (1 red plate).
- Use the back arrow to go back to the order form.
- Change the fields for 3 green Cups.
- Click on "Save" to place the second order.
- In another tab, go back to the AppSheet main page.
- Go to "Databases | Store".
- Verify that there are 2 orders in the Order table.
Create the Process Order Application
- Click on the main AppSheet icon.
- Go to "Create | App | Start with existing data".
- For "App name", enter "Process Order".
- For "Category", choose "Other".
- Click the "Choose your data" button.
- Choose "AppSheet Database".
- Choose "Store".
- We only want this app to update existing order records, so uncheck "Add" and "Delete" to the right of "Order".
- Confirm that only "Update" shows to the right of "Order".
- Click on the "Create app" button.
- Click on the "Customize with AppSheet" button.
- In the toolbar on the far left, click on the "Data" icon (the one just above the "Views" icon).
- Uncheck "EDITABLE?" for "Email", "Quantity", "Colour", and "Item" fields.
- Only Status should be "EDITABLE?" checked.
Only Show "Not Started" Orders
- Click on the "Views" icon on the far left toolbar (it looks like a little mobile phone).
- Click on the "Use slices to filter your data" link.
- Click the "Create a new slice for Order" button.
- Click in the "Row filter condition" field.
- Click the "Create a custom expression" link.
- In the "Enter an expression" area, enter:
[Status] = "Not Started"
- Click the "Save" button.
- Click the "Done" button at the top right.
- Click the big "SAVE" button at the top right.
Finishing up the App
- In the toolbar on the far left, click on the "Settings" icon (looks like a gear).
- Under "App Properties" turn on the "Personal use only?" setting.
- Click the big "SAVE" button at the top right to save your changes.
Deploying the App
- In the toolbar on the far left, click on the "Deploy" icon (looks like a rocket).
- Click "Deployment Check".
- Scroll down. It looks like there is an error. You can click the "ERROR" button to see the details. For personal use apps, this is not a problem.
- Click the "Move app to deployed state despite errors" button.
Running the App
- In the toolbar at the top, click on the "Share" icon (looks like a "+" sign next to a head-and-shoulders icon).
- Click on "Copy sharing links" and copy "Browser Link".
- In a new browser tab, paste the link.
- Select one of the "Not Started" orders.
- Click on the "Edit" button.
- Change the "Status" to "Complete".
- Click the "Save" button.
- Notice the order disappears from the "Not Started" list!
- In another tab, go back to the AppSheet main page.
- Go to "Databases | Store".
- Review the "Status" of each order.