Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

In this use case, you will learn how to create internal shopping lists in a grid. Using the Driving Table feature to create a product list and the formula column to calculate the total of the purchase.

You will also learn how to use several features in TGNG app such as:

Connecting an external data source

Data Mirror

How to add option attributes to a list

How to fill in a list with dynamic options

Table of Contents
stylenone

Introduction

You can create a stand-alone list of products using the Driving Table. Then use it in a grid as a dynamic list of available products. 

The dynamic list is based on a Driving Table,  maintained in the Table Grid Next Generation admin. You can save the table in the database using the Data Mirror.

Prerequisites

  • User logged into their account, installed Table Grid Next Generation Server / Datacenter app

  • User created a related Jira project

  • User had the admin role on Jira 

  • User had a database system such as: MySQL, Postgres, SQL Server, etc.

  • Table Grid with a dynamic list of products.

Post-condition

  • User can use the grid to update related information for the list of products

  • User can create issues using the Shopping List grid

  • User can download/upload the Configuration for personal usage

  • User can add more rows to fill the shopping list such as: total, quantity,..

Conditions

  • Required fields are marked with a red asterisk *

  • The grid must contain at least one column, or else it will show the pop-up message
    “Error table-config-column-config-required”.

  • The grid can be displayed in more than one project

  • User have to set the name of Column to be an exact match with Column of the database.

    User need to type the correct statement for the “SQL query”. For example:

    Code Block
    SELECT column1, column2, ... FROM table_name;

Flow chart diagram

Drawio
mVer2
zoom1
simple0
inComment0
custContentId100335708
pageId99975291
lbox1
diagramDisplayNameUntitled Diagram-1713868081051.drawio
contentVer4
revision4
baseUrlhttps://tablegrid.atlassian.net/wiki
diagramNameUntitled Diagram-1713868081051.drawio
pCenter1
width511.00000000000006
links
tbstyle
height2191

Configure Shopping List Grid

Basic Flow

Action

1

Click Add Data Source in Data Source

image-20240424-043311.png
2

Fill all required information in Data Source

image-20240424-044139.png
3

Click Test Connection to examine the connection between database and Jira

4

Click Save to save data source

5

In Table Grid section, choose Grids 

6

In Driving Table, click Add Driving Table button to add new driving table

image-20240424-045524.png
7

Fill information for “Name

In this example, user used

  • Name = “Products

8

In Configuration - Column, click Add new column to create new column

9

In Add Column, choose String in Column type

User fill information for Identifier and Title

Type “code“ as Identifier and type “Code” as Title

image-20240424-050127.png

Click Add to save the information 

10

In Add Column, choose String in Column type

User fill information for Identifier and Title

Type “name“ as Identifier and type “Name” as Title

image-20240424-050248.png

Click Add to save the information 

11

In Add Column, choose Number in Column type

User fill information for Identifier and Title

Type “price“ as Identifier and type “Price” as Title

image-20240424-050349.png

Click Add to save the information 

12

In Configuration - Data Mirror,

Select the Data Source that you created in step #4

Fill the Database table name

Note

The Database table name must be unique in your database

image-20240424-050545.png

Click Create table to create table in your database

13

Click Save to save the Driving Table Config

14

Click image-20240424-051445.png to add row in the Driving Table
Fill the product information into Driving Table

image-20240424-051939.png

Click image-20240424-052023.png to save the Driving Table

15

In Grid Fields, click Add Grid button to add new grid

image-20240424-044608.png
16

Fill information for “Name” and “Description” 

In this example, user used

  • Name = “Shopping List

  • Description = “Shopping List use case

image-20240424-045003.png
17

In Configuration - Column, click Add new column to create new column

18

In Add Column, choose Single Select List in Column type

User fill information for Identifier and Title

Type “jproduct“ as Identifier and type “Product” as Title

image-20240424-052302.png

To display the price automatically, use the dynamic option mapping. You need to map the option label to display the product name and the option value to display the price. 

In Option attributes, click image-20240424-052712.png to add option attribute

Type “price” as Key

image-20240424-093702.png

In Dynamic options, chooseyour databasefor Data Source and type the SQL query:

Code Block
SELECT name, price FROM products

Click Get data to get data from your database

image-20240424-054057.png

In Mapping:

  • for label, select “name”

  • for price, select “price”

image-20240424-095316.png

Click (blue star) to save the dynamic options

Click Add to save the information 

19

In Configuration - Column, click Add new column to create new column

20

In Add Column, choose Formula in Column type

User fill information for Identifier and Title

Type “jprice“ as Identifier and type “Price” as Title

image-20240424-070626.png

In Formula expression, type:

Code Block
var result;
if($(jproduct).hasOwnProperty('optionObject')){
  result = $(jproduct).optionObject.price;
}else{
  result = $(jproduct).price;
}
return result;

Click Add to save the information 

21

In Configuration - Column, click Add new column to create new column

22

In Add Column, choose Integer in Column type

User fill information for Identifier and Title

Type “jquantity“ as Identifier and type “Quantity” as Title

image-20240424-073659.png

Click Add to save the information 

23

In Configuration - Column, click Add new column to create new column

24

In Add Column, choose Formula in Column type

User fill information for Identifier and Title

Type “jtotal“ as Identifier and type “Total” as Title

image-20240424-073936.png

In Formula expression, type:

Code Block
return $(jprice)*$(jquantity)

Click Add to save the information 

25

Click Save to save the grid configuration 

image-20240424-082258.png

Exceptional Flow

Users clicks “Cancel” at “Data Source”

Continued from step #2 in the Basic Flow:

Step

Description

3

The system will automatically come back to the “Data Source” page

Use case stops. 

Users type the wrong information about the data source

Continued from step #4 in the Basic Flow:

Step

Description

5

An “Errors” message appears 

Use case stops.

Users type wrong SQL query 

Continued from step #18 in the Basic Flow:

Step

Description

19

An “Errors” message appears 

Use case stops. 

Users click “Cancel” when saving the config

Continued from step #24 in the Basic Flow:

Step

Description

25

The system shows a pop-up message: “Exit without saving?”

26

User click Yes button

Use case stops. 

Use Shopping List Grid in a Jira project

Create a Jira project

  1. Click Project on the Navigation bar

  2. Click Create project

  3. Fill required information to create project

image-20240424-084100.png

Add grid on project screen

  1. Click Issues tab, in Screens section choose Screens

  2. Click Configure on your project

image-20240424-085725.png
  1. Select Shopping List as a custom field
    Click Add to add field on project screen
    Turn image-20240424-090222.png the field to show it on project screen even when empty

image-20240424-090056.png

Create an issue with Shopping List

  1. Open your project

  2. Click image-20240424-090741.png on Navigation bar to create an issue

  3. Click image-20240424-092953.png to add row and fill the information

Product: You can select the product from the dynamic list which is configured as a Driving Table.

Price: When you select a product from the drop-down list, the price is added automatically to the grid. We’ve used a JavaScript-based formula column type to get the price.

Quantity: You can type any number.

Total: The total quote for each product is calculated automatically using the formula column.

image-20240424-092733.png

You can update the list of products and change prices in the stand-alone table used to store product-related information. This does not require changing your grid configuration.