In this section table objects will be described for Foodmart
on its wic wic_sample_foodmart
. For more information on how to create this forms you can visit Chinook
Basic table objects for a more detailed explanation.
1 Introduction
In here you will find a list and a brief explanation on what each of the table objects do and to what tables they are related to.
Object | Tag | Title | Render Type | Type of object | Ordered by | Tables related | Description |
---|---|---|---|---|---|---|---|
department | Department | DEPARTMENT | Form multirow | READ / WRITE |
department
|
Transactional list of departments by id, description and state. | |
store | Stores | STORES | Form singlerow | READ / WRITE |
store.store_id
|
store
|
Transactional form of stores with employees per store list and a child tab to Warehouse. |
warehouse | Warehouse | WAREHOUSE | Form singlerow | READ / WRITE |
warehouse.warehouse_id
|
warehouse , warehouse_class
|
Transactional form of warehouse with a parent tab to Store. |
products | Products | PRODUCTS | Form singlerow | READ / WRITE |
product.product_id
|
product , product_class
|
Transactional form of products. |
customers | Customers | CUSTOMERS | Form singlerow | READ / WRITE |
customer.customer_id
|
customer, region
|
Transactional form of customers. |
employees | Employees | EMPLOYEES | Form singlerow | READ / WRITE |
employee.employee_id
|
employee , position , sotre , department
|
Transactional form of employees with hierarchy view, list of supervised employees and list of other employees. |
employee_analytics1 | Employee hierarchy | EMPLOYEE HIERARCHY | Form singlerow | READ ONLY |
employee
|
Hierarchy view of employee. | |
store_analytics | Sales analytics | SALES ANALYTICS | Form singlerow | READ ONLY |
sales_fact , time_by_day
|
Sales form by date. | |
sales_analytics2 | Sales analytics II | SALES ANALYTICS II | Form singlerow | READ ONLY |
sales_fact , time_by_day
|
Sales form by month and datetime. | |
store_analytics1 | Stores Dashboard | STORES DASHBOARD | Form singlerow | READ ONLY |
sales_fact_month_store
|
Stores dashboard with sales form by type of store, city and store department. | |
store_analytics2 | Timeseries Sales | TIMESERIES SALES | Form singlerow | READ ONLY |
sales_fact_month_store
|
Store sales by timeline. | |
store_analytics3 | States vs Family | STORE DISTRICT VS FAMILY | Form singlerow | READ ONLY |
sales_fact , store , region , product , product_class , time_by_day
|
States vs product family. | |
product_analytics1 | Products Dashboard | PRODUCTS DASHBOARD | Form singlerow | READ ONLY |
sales_fact_month_product
|
Product dashboard with sales by year, category and subcategory of product, product family and month, product family and country and by department and city. | |
units_analytics | Analysis by subcategory | ANALYSIS BY SUBCATEGORY | Form singlerow | READ ONLY |
sales_fact_yearmonth_product , product , product_class
|
Unit sales form by month, year and product subcategory. | |
customer_analytics1 | Dashboard Customer | DASHBOARD CUSTOMER | Form singlerow | READ ONLY |
sales_fact_month_customer
|
Customer sales form by yearly income and genere, marital status, yearly income, and genere, ocupation and membership card. | |
customer_calendar | Customer birthday calendar | CUSTOMER BIRTHDAY CALENDAR | Form singlerow | READ ONLY |
customer
|
Customer birthday calendar. |
All this atributes are modified in the Objects wic.
To learn more about Object definitions check Developement Guide
> Views > Objects.
The application menu looks like this. To know how to configure the Panels and the Menus check the section Menus on the Developement Guide
documentation.
In the next sections the table objects will be ordered the same way we an find them in the Foodmart
application. Each section belongs to a folder and on each folder we can find the following table objects.
2 Foodmart
In this Panel we can find the tables of department, store, customer, product and employee data as well as sales reports and analytics.
2.1 Department
<select>
<columns>
<rowid table='department' />,
department.department_id,
department.department_description,
department.state
</columns>
<from table='department' />
</select>
department | |
---|---|
Label | Description |
Identifier | Department identifier. |
Description | Department description. |
State | State (Active-Drop)
|
2.2 Stores
<select>
<columns>
<rowid table='store'/>,
store.store_id,
store.store_type,
store.region_id, region.sales_region,
store.store_name,
store.store_number,
store.store_street_address,
store.store_city,
store.store_state,
store.store_postal_code,
store.store_country,
store.store_manager,
store.store_phone,
store.store_fax,
store.first_opened_date,
store.last_remodel_date,
store.store_sqft,
store.grocery_sqft,
store.frozen_sqft,
store.meat_sqft,
store.coffee_bar,
store.video_store,
store.salad_bar,
store.prepared_food,
store.florist,
store.state
</columns>
<from table='store' >
<join table='region'>
<on>store.region_id = region.region_id</on>
</join>
</from>
</select>
store | |
---|---|
Label | Description |
Identifier | Store identifier |
Store Type | Store type. |
Region | |
Store Name | Store name |
Number | |
Address | |
City | |
State | |
Postal code | Postal code. |
Country | |
Manager | |
Phone | |
Fax | |
Opend Date | Opening date. |
Remodel Date | Remodeling date |
Store Sqft. | Store squared feet. |
Grocery Sqft. | Groceries squared feet |
Frozen Sqft. | Frozen area squared feet. |
Meat Sqft. | Meat squared feet. |
Coffee Bar | Coffee bar (Yes-No)
|
Video | Videoclub
|
Salad Bar | Salad bar (Yes-No)
|
Prepared Food | Prepared food ( Yes-No)
|
Florist | Florist(Yes-No)
|
State | State (Active-Drop)
|
2.2.1 Warehouse
<select>
<columns>
<rowid table='warehouse'/>,
warehouse.warehouse_id,
warehouse.warehouse_class_id,
warehouse.stores_id,
warehouse.warehouse_name,
warehouse.wa_address1,
warehouse.wa_address2,
warehouse.wa_address3,
warehouse.wa_address4,
warehouse.warehouse_city,
warehouse.warehouse_state_province,
warehouse.warehouse_postal_code,
warehouse.warehouse_country,
warehouse.warehouse_owner_name,
warehouse.warehouse_phone,
warehouse.warehouse_fax
</columns>
<from table='warehouse' />
</select>
warehouse | |
---|---|
Label | Description |
Identifier | Warehouse identifier |
Class | |
Store ID | Store identifier |
Description | Warehouse description |
Address 1 | Address |
Address 2 | Address |
Address 3 | Address |
Address 4 | Address |
City | |
State | |
Postal code | Postal code. |
Country | |
Owner Name | Owner's name. |
Phone | |
Fax |
2.3 Products
<select>
<columns>
<rowid table='product'/>,
product.product_id,
product.product_name,
product.product_class_id,
product_class.product_category,
product.brand_name,
product.sku,
product.srp,
product.gross_weight,
product.net_weight,
product.recyclable_package,
product.low_fat,
product.units_per_case,
product.cases_per_pallet,
product.shelf_width,
product.shelf_height,
product.shelf_depth
</columns>
<from table='product'>
<join table='product_class' >
<on>product.product_class_id = product_class.product_class_id</on>
</join>
</from>
</select>
product | |
---|---|
Label | Description |
Identifier | Product identifier. |
Product | |
Class | |
Brand | |
SKU | stock keeping unit
|
SRP | Shelf-ready packaging |
Gross Weight | Gross weight |
Net Weight | |
Recyclable Package | Recyclable Packaging (Yes-No)
|
Low Fat | Low Fat(Yes-No)
|
Units per case | |
Cases per pallet | |
Shelf Width | |
Shelf Height | |
Shelf Depth |
2.4 Customers
<select>
<columns>
<rowid table='customer'/>,
customer.customer_id,
customer.fullname,
customer.lname,
customer.fname,
customer.account_num,
customer.mi,
customer.address1,
customer.address2,
customer.address3,
customer.address4,
customer.city,
customer.state_province,
customer.postal_code,
customer.country,
customer.customer_region_id, region.sales_region,
customer.phone1,
customer.phone2,
customer.birthdate,
customer.marital_status,
customer.yearly_income,
customer.gender,
customer.total_children,
customer.num_children_at_home,
customer.date_accnt_opened,
customer.member_card,
customer.occupation,
customer.houseowner,
customer.num_cars_owned
</columns>
<from table='customer'>
<join table='region' >
<on>customer.customer_region_id = region.region_id</on>
</join>
</from>
</select>
customer | |
---|---|
Label | Description |
Identifier | Customer identifier. |
Full Name | |
Last Name | |
First Name | |
Account Num | |
MI | Middle Initial |
Address 1 | Address |
Address 2 | Address |
Address 3 | Address |
Address 4 | Address |
City | |
State | |
Postal code | Postal code. |
Country | |
Region | |
Phone 1 | Phone |
Phone 2 | Phone |
Birthdate | |
Marital Status |
|
Yearly Income | |
Gender | Gender(Female-Male)
|
Children | Number of Children |
Children at home | Number of Children at home |
Account Opening Date | |
Member Card | |
Occupation | |
House owner | House owner(Yes-No)
|
Cars |
2.5 Employees
2.5.1 Object
<select>
<columns>
<rowid table='employee'/>,
employee.employee_id,
employee.full_name,
employee.first_name,
employee.last_name,
employee.position_id, position.position_title,
employee.store_id, store.store_name,
employee.department_id, department.department_description,
employee.birth_date,
employee.hire_date,
employee.end_date,
employee.salary,
employee.supervisor_id, employee2.full_name supervisor_name,
employee.education_level,
employee.marital_status,
employee.gender,
employee.management_role,
employee.state
</columns>
<from table='employee' >
<join table='position' >
<on>employee.position_id = position.position_id</on>
</join>
<join table='store' >
<on>employee.store_id = store.store_id</on>
</join>
<join table='department' >
<on>employee.department_id = department.department_id</on>
</join>
<join type='left' table='employee' alias='employee2'>
<on>employee.supervisor_id = employee2.employee_id</on>
</join>
</from>
</select>
employee | |
---|---|
Label | Description |
Identifier | Employee Identifier |
Full Name | |
First Name | |
Last c | Apellidos |
Position | |
Store ID | Store identifier |
Department ID | Department identifier. |
Birth Date | |
Hire Date | |
End Date | Contract End Date |
Salary | |
Supervisor ID | Supervisor identifier |
Education Level | |
Marital status |
|
Gender |
|
Management Role | |
Status | Status(Active-Inactive)
|
2.5.2 Graphs
D3 Graph
Type: Hierarchy Tree
XML
<union> <select> <columns> employee.employee_id <alias name='id'/>, employee.full_name <alias name='name'/>, employee.supervisor_id <alias name='parent_id'/> </columns> <from table='employee'/> <where> employee.employee_id = (SELECT supervisor_id FROM employee WHERE employee_id = ${employee_id}) </where> </select> <select> <columns> employee.employee_id <alias name='id'/>, employee.full_name <alias name='name'/>, employee.supervisor_id <alias name='parent_id'/> </columns> <from table='employee'/> <where> employee.employee_id = ${employee_id} </where> </select> <select> <columns> employee.employee_id <alias name='id'/>, employee.full_name <alias name='name'/>, employee.supervisor_id <alias name='parent_id'/> </columns> <from table='employee'/> <where> employee.supervisor_id = ${employee_id} </where> <order>1</order> </select> </union>
2.6 Employees Hierarchy
2.6.1 Object
<select-one>1</select-one>
internal-xsqlselect-unnamed (employee_analytics1) | |
---|---|
Label | Description |
2.6.2 Graphs
D3 Graph
Type: Hierarchy Tree
XML
<select> <columns> employee.employee_id <alias name='id'/>, employee.full_name <alias name='name'/>, employee.supervisor_id <alias name='parent_id'/> </columns> <from table="employee"/> <order>id</order> </select>
2.7 Sales Analytics
2.7.1 Object
<select>
<columns>
sales_fact.product_id,
sales_fact.time_id,
sales_fact.customer_id,
sales_fact.promotion_id,
sales_fact.store_id,
sales_fact.store_sales,
sales_fact.store_cost,
sales_fact.unit_sales,
time_by_day.the_year
</columns>
<from table='sales_fact'>
<join table='time_by_day'>
<on>sales_fact.time_id = time_by_day.time_id</on>
</join>
</from>
<where>
time_by_day.the_year = $THE_YEAR
</where>
</select>
sales_fact (store_analytics) | |
---|---|
Label | Description |
Product ID | Product identifier |
Time ID | Time identifier |
Customer ID | Customer Identifier |
Promotion ID | Promotion identifier |
Store ID | Store identifier |
Sales | Store sales |
Cost | Store cost |
Unit Sales |
2.7.2 Graphs
D3 Graph
Type: Finviz
XML
<drop table='@tmp1' onexception='ignore' /> <select intotemp='@tmp1'> <columns> time_by_day.the_date <alias name='the_date' />, NVL(SUM(sales_fact.store_sales),0) v_sales_prev </columns> <from table='sales_fact'> <join table='time_by_day'> <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <group>1</group> </select> <select> <columns> time_by_day.the_date <alias name='date' />, SUM(sales_fact.unit_sales) <alias name='value1' />, (SUM(sales_fact.store_sales) - SUM(sales_fact.store_cost)) <alias name='value2' />, CASE WHEN (SELECT SUM(v_sales_prev) FROM @tmp1 WHERE the_date + 1 UNITS YEAR = time_by_day.the_date) = 0 THEN 0 ELSE ROUND(((((SUM(sales_fact.store_sales))/(SELECT SUM(v_sales_prev) FROM @tmp1 WHERE the_date + 1 UNITS YEAR = time_by_day.the_date))-1) * 100),2) END <alias name='value3'/>, NVL(SUM(sales_fact.store_sales),0) <alias name='value4' />, (SELECT SUM(v_sales_prev) FROM @tmp1 WHERE the_date + 1 UNITS YEAR = time_by_day.the_date) <alias name='value5' />, 'Unit sales' <alias name='value1_name'/>, 'Profit' <alias name='value2_name'/>, '% prev.' <alias name='value3_name'/>, 'Sales' <alias name='value4_name'/>, 'Sales prev.' <alias name='value5_name'/> </columns> <from table='sales_fact'> <join table='time_by_day'> <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_year = ${the_year} </where> <group>1</group> </select>
2.8 Sales Analytics II
2.8.1 Object
<select>
<columns>
the_year,
get_human_readable_money(SUM(sales_fact.store_sales),2) year_sales,
get_human_readable_money(SUM(sales_fact.store_cost),2) year_cost,
get_human_readable_money((SUM(sales_fact.store_sales) - SUM(sales_fact.store_cost)),2) year_profit
</columns>
<from table='sales_fact'>
<join table='time_by_day' >
<on>sales_fact.time_id = time_by_day.time_id</on>
</join>
</from>
<where>
time_by_day.the_year = $THE_YEAR
</where>
<group>1</group>
</select>
sales_fact (sales_analytics2) | |
---|---|
Label | Description |
2.8.2 Graphs
SQL JChar
Type: Cartesian
XML
<select> <columns> time_by_day.month_of_year, time_by_day.the_month, SUM(sales_fact.store_cost) store_cost, SUM(sales_fact.store_sales) store_sales, (SUM(sales_fact.store_sales) - SUM(sales_fact.store_cost)) profit </columns> <from table='sales_fact'> <join table='time_by_day' > <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_year = ${the_year} </where> <group>1,2</group> <order>1</order> </select>
Type: Polar
XML
<select> <columns> time_by_day.month_of_year, time_by_day.the_month, SUM(sales_fact.store_cost) store_cost, SUM(sales_fact.store_sales) store_sales, (SUM(sales_fact.store_sales) - SUM(sales_fact.store_cost)) profit </columns> <from table='sales_fact'> <join table='time_by_day'> <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_year = ${the_year} </where> <group>1,2</group> <order>1</order> </select>
Type: Timeseries
XML
<select> <columns> time_by_day.the_date the_datetime, sum(sales_fact.unit_sales) unit_sales, sum(sales_fact.store_cost) store_cost, sum(sales_fact.store_sales) store_sales </columns> <from table='sales_fact'> <join table='time_by_day'> <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_year = ${the_year} </where> <group>1</group> <order>1</order> </select>
3 Store Analytics
This Panel includes a store dashboard a timeseries and a comparison between store districts and product families.
3.1 Stores Dashboard
3.1.1 Object
<select>
<columns>
the_year
</columns>
<from table='sales_fact_month_store'/>
<where>
the_year = $THE_YEAR
</where>
</select>
sales_fact_month_store (store_analytics2) | |
---|---|
Label | Description |
Year |
3.1.2 Graphs
SQL Table
Type: Supertable
XML
<select> <columns> store.store_id, store.store_name, store.store_city, <!--sfms.unit_sales,--> row('ball', 'a', sfms.unit_sales, (select Min(abs(a.unit_sales)) from sales_fact_month_store a),(select Max(abs(a.unit_sales)) from sales_fact_month_store a)) Bunit_sales, CASE WHEN sfms.unit_sales_prev = 0 THEN 100 ELSE ROUND(((((sfms.unit_sales) / (sfms.unit_sales_prev))-1) * 100),2) END unit_sales_perc, sfms.sales, row('vbar', 'Jan', sales_jan, 'Feb', sales_feb, 'Mar', sales_mar, 'Apr', sales_apr, 'May', sales_may, 'Jun', sales_jun, 'Jul', sales_jul , 'Aug', sales_ago, 'Sep', sales_sep, 'Oct', sales_oct, 'Nov', sales_nov, 'Dec', sales_dec) sales_m, row('percent', '%', sfms.sales_pct,0,100) sales_perc, (sfms.sales - sfms.sales_prev) sales_comp, sfms.cost, row('line', 'Jan', cost_jan, 'Feb', cost_feb, 'Mar', cost_mar, 'Apr', cost_apr, 'May', cost_may, 'Jun', cost_jun, 'Jul', cost_jul , 'Aug', cost_ago, 'Sep', cost_sep, 'Oct', cost_oct, 'Nov', cost_nov, 'Dec', cost_dec) cost_m, row('mm', 'Margin', (sfms.cost_prev - sfms.cost), (select Min(a.cost_prev - a.cost) from sales_fact_month_store a),(select Max(a.cost_prev - a.cost) from sales_fact_month_store a)) cost_dif, cost_pct </columns> <from table='sales_fact_month_store' alias='sfms'> <join table='store'> <on>sfms.store_id = store.store_id</on> </join> </from> <where> the_year = ${the_year} </where> <order>1</order> </select>
SQL JChar
Type: Cartesian
XML
<call> <args> <arg>${the_year}</arg> </args> <![CDATA[ <xsql-script name='xsql_pivot'> <args> <arg name='p_the_year' type='integer' /> </args> <body> <vtable name='v_out'> <select> <columns> store.store_type, time_by_month.quarter, SUM(sales_fact_yearmonth_store.sales) store_sales </columns> <from table='sales_fact_yearmonth_store'> <join table='store'> <on>sales_fact_yearmonth_store.store_id = store.store_id</on> </join> <join table='time_by_month'> <on>sales_fact_yearmonth_store.month_of_year = time_by_month.month_of_year</on> </join> </from> <where> sales_fact_yearmonth_store.the_year = <p_the_year/> </where> <group>1,2</group> <order>2</order> </select> </vtable> <return><vtable.pivot name='v_out' pivotcolumns='store_type' pivotsort='quarter' datacolumns='store_sales' /></return> </body> </xsql-script> ]] > </call>
Type: Cartesian
XML
<select> <columns> store.store_city, time_by_month.quarter, SUM(sales_fact_yearmonth_store.sales) total_sales </columns> <from table='sales_fact_yearmonth_store'> <join table='store'> <on>sales_fact_yearmonth_store.store_id = store.store_id</on> </join> <join table='time_by_month'> <on>sales_fact_yearmonth_store.month_of_year = time_by_month.month_of_year</on> </join> </from> <where> sales_fact_yearmonth_store.the_year = ${the_year} </where> <group>1,2</group> <order>2</order> </select>
Type: Pie
XML
<select> <columns> store.store_type, SUM(sales_fact_month_store.profit) profit </columns> <from table='sales_fact_month_store'> <join table='store'> <on>sales_fact_month_store.store_id = store.store_id</on> </join> </from> <where> sales_fact_month_store.the_year = ${the_year} </where> <group>1</group> <order>1</order> </select>
D3 Graph
Type: Matrix
XML
<select> <columns> product_class.product_department x_name, product_class.product_family x_group, store.store_name y_name, SUM(sales_fact.store_sales) value </columns> <from table='sales_fact'> <join table='store'> <on>sales_fact.store_id = store.store_id</on> </join> <join table='product'> <on>sales_fact.product_id = product.product_id</on> <join table='product_class'> <on>product.product_class_id = product_class.product_class_id</on> </join> </join> <join table='time_by_day'> <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_year = ${the_year} </where> <group>1,2,3</group> <order>3</order> </select>
3.2 Sales Timeseries
3.2.1 Object
<select>
<columns>
the_year
</columns>
<from table='sales_fact_month_store'></from>
<where>
the_year = $THE_YEAR
</where>
</select>
sales_fact_month_store (store_analytics1) | |
---|---|
Label | Description |
Year |
3.2.2 Graphs
D3 Graph
Type: Timeseries
XML
<select> <columns> store.store_name <alias name='data_name' />, time_by_day.the_date <alias name='the_date' />, store.store_id <alias name='category' />, NVL(SUM(sales_fact.store_sales),0) <alias name='value' /> </columns> <from table='store'> <join table='sales_fact'> <on>sales_fact.store_id = store.store_id</on> <join table='time_by_day'> <on>sales_fact.time_id = time_by_day.time_id</on> </join> </join> </from> <where> time_by_day.the_year = ${the_year} </where> <group>1,2,3</group> <order>2</order> </select>
3.3 Stores-District vs Family
3.3.1 Object
<select-one>$FECINI <alias name='fecini'/>,$FECFIN <alias name='fecfin'/></select-one>
internal-xsqlselect-unnamed (store_analytics3) | |
---|---|
Label | Description |
3.3.2 Graphs
D3 Graph
Type: Chord
XML
<select> <columns> product_class.product_department x_name, <!-- store.store_state y_name,--> region.sales_district y_name, SUM(sales_fact.store_sales) value </columns> <from table='sales_fact'> <join table='store'> <on>sales_fact.store_id = store.store_id</on> <join table='region'> <on>store.region_id = region.region_id</on> </join> </join> <join table='product'> <on>sales_fact.product_id = product.product_id</on> <join table='product_class'> <on>product.product_class_id = product_class.product_class_id</on> </join> </join> <join table='time_by_day'> <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_date BETWEEN $FECINI and $FECFIN </where> <group>1,2</group> <order>2</order> </select>
4 Product Analytics
This Panel includes a product dashboard and an analysis by product category for a specific month and year.
4.1 Products Dashboard
<select>
<columns>
the_year,
get_human_readable_money(SUM(sales),2) sales,
get_human_readable_money(SUM(sales_prev),2) sales_prev,
get_human_readable_money(SUM(cost),2) cost,
get_human_readable_money(SUM(cost_prev),2) cost_prev,
get_human_readable_money(SUM(profit),2) profit
</columns>
<from table='sales_fact_month_product'/>
<where>
the_year = $THE_YEAR
</where>
<group>1</group>
<order>1</order>
</select>
sales_fact_month_product (product_analytics1) | |
---|---|
Label | Description |
Year |
4.1.1 Graphs
SQL JChar
Type: Cartesian
XML
<select> <columns> the_year, SUM(sales) sales </columns> <from table='sales_fact_month_product'> <join table='product'> <on>sales_fact_month_product.product_id = product.product_id</on> <join table='product_class'> <on>product.product_class_id = product_class.product_class_id</on> </join> </join> </from> <group>1</group> <order>1</order> </select>
Type: Cartesian
XML
<call> <args> <arg>${the_year}</arg> </args> <![CDATA[ <xsql-script> <args> <arg name='p_the_year' type='integer' /> </args> <body> <vtable name='v_out'> <select> <columns> product_class.product_family <alias name='product_family'/>, time_by_day.month_of_year, SUM(sales_fact.store_sales) month_sales </columns> <from table='sales_fact'> <join table='product'> <on>sales_fact.product_id = product.product_id</on> <join table='product_class'> <on>product.product_class_id = product_class.product_class_id</on> </join> </join> <join table='time_by_day' > <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_year = <p_the_year/> </where> <group>1,2</group> <order>2</order> </select> </vtable> <return><vtable.pivot name='v_out' pivotcolumns='product_family' datacolumns='month_sales' /></return> </body> </xsql-script> ]] > </call>
Type: Pie
XML
<select> <columns> product_class.product_department, store.store_country, SUM(sales_fact.store_sales) store_sales </columns> <from table='sales_fact'> <join table='product'> <on>sales_fact.product_id = product.product_id</on> <join table='product_class'> <on>product.product_class_id = product_class.product_class_id</on> </join> </join> <join table='store'> <on>sales_fact.store_id = store.store_id</on> </join> <join table='time_by_day' > <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_year = ${the_year} </where> <group>1,2</group> <order>1</order> </select>
Type: Heatmap
XML
<call> <args> <arg>${the_year}</arg> </args> <![CDATA[ <xsql-script> <args> <arg name='p_the_year' type='integer' /> </args> <body> <vtable name='v_out'> <select> <columns> product_class.product_department <alias name='x_name'/>, store.store_city <alias name='y_name'/>, (SUM(sales_fact.store_sales) - SUM(sales_fact.store_cost)) <alias name='total'/> </columns> <from table='sales_fact'> <join table='product'> <on>sales_fact.product_id = product.product_id</on> <join table='product_class'> <on>product.product_class_id = product_class.product_class_id</on> </join> </join> <join table='store'> <on>sales_fact.store_id = store.store_id</on> </join> <join table='time_by_day' > <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> time_by_day.the_year = <p_the_year/> </where> <group>1,2</group> <order>1</order> </select> </vtable> <return><vtable.pivot name='v_out' pivotcolumns='y_name' datacolumns='total'/></return> </body> </xsql-script> ]] > </call>
4.2 Analysis by subcategory
<select>
<columns>
month_of_year,
the_year
</columns>
<from table='sales_fact_yearmonth_product'/>
<where>
month_of_year $MONTH_OF_YEAR AND
the_year = $THE_YEAR
</where>
</select>
sales_fact_yearmonth_product (units_analytics) | |
---|---|
Label | Description |
Month Number | |
Year |
5 Customer Analytics
This Panel includes a customer dashboard and a calendar for the customers' birthdays.
5.1 Customers Dashboard
5.1.1 Object
<select>
<columns>
the_year
</columns>
<from table='sales_fact_month_customer'></from>
<where>
the_year = $THE_YEAR
</where>
</select>
sales_fact_month_customer (customer_analytics1) | |
---|---|
Label | Description |
Year |
5.1.2 Graphs
SQL JChar
Type: Cartesian
XML
<union type='all' intotemp='@tmp1'> <select> <columns> customer.yearly_income, NVL(SUM(sales_fact_month_customer.sales),0) store_sales_m, 0 store_sales_f </columns> <from table='sales_fact_month_customer'> <join table='customer'> <on>sales_fact_month_customer.customer_id = customer.customer_id</on> </join> </from> <where> customer.gender = 'M' and the_year = ${the_year} </where> <group>1</group> </select> <select> <columns> customer.yearly_income, 0 store_sales_m, NVL(SUM(sales_fact_month_customer.sales),0) store_sales_f </columns> <from table='sales_fact_month_customer'> <join table='customer'> <on>sales_fact_month_customer.customer_id = customer.customer_id</on> </join> </from> <where> customer.gender = 'F' and the_year = ${the_year} </where> <group>1</group> <order>1</order> </select> </union> <select> <columns> yearly_income, SUM(store_sales_m) store_sales_m, (SUM(store_sales_f) * -1) <alias name='store_sales_f'/> </columns> <from table='@tmp1'/> <group>1</group> <order>1</order> </select>
Type: Cartesian
XML
<union type='all' intotemp='@tmp2'> <select> <columns> the_month, month_of_year, the_year, SUM(sales_fact_yearmonth_customer.sales) store_sales_married, 0 store_sales_single, SUM(sales_fact_yearmonth_customer.cost) store_cost_married, 0 store_cost_single, SUM(sales_fact_yearmonth_customer.profit) profit_married, 0 profit_single </columns> <from table='sales_fact_yearmonth_customer'> <join table='customer'> <on>sales_fact_yearmonth_customer.customer_id = customer.customer_id</on> </join> </from> <where> customer.marital_status = 'M' </where> <group>1,2,3</group> </select> <select> <columns> the_month, month_of_year, the_year, 0 store_sales_married, SUM(sales_fact_yearmonth_customer.sales) store_sales_single, 0 store_cost_married, SUM(sales_fact_yearmonth_customer.cost) store_cost_single, 0 profit_married, SUM(sales_fact_yearmonth_customer.profit) profit_single </columns> <from table='sales_fact_yearmonth_customer'> <join table='customer'> <on>sales_fact_yearmonth_customer.customer_id = customer.customer_id</on> </join> </from> <where> customer.marital_status = 'S' </where> <group>1,2,3</group> <order>2,3</order> </select> </union> <select> <columns> the_month, month_of_year, the_year, SUM(store_sales_married) store_sales_married, SUM(store_sales_single) store_sales_single, SUM(store_cost_married) store_cost_married, SUM(store_cost_single) store_cost_single, SUM(profit_married) profit_married, SUM(profit_single) profit_single </columns> <from table='@tmp2'/> <where> the_year = ${the_year} </where> <group>1,2,3</group> <order>2,3</order> </select>
Type: Pie
XML
<select> <columns> customer.yearly_income, SUM(sales_fact_month_customer.sales) store_sales </columns> <from table='sales_fact_month_customer'> <join table='customer'> <on>sales_fact_month_customer.customer_id = customer.customer_id</on> </join> </from> <where> the_year = ${the_year} </where> <group>1</group> <order>1</order> </select>
D3 Graph
Type: Sankey
XML
<union type="all"> <select> <columns> customer.gender <alias name='source'/>, customer.occupation <alias name='target'/>, count(*) <alias name='value'/> </columns> <from table='sales_fact_month_customer'> <join table='customer'> <on>sales_fact_month_customer.customer_id = customer.customer_id</on> </join> </from> <where> the_year = ${the_year} </where> <group>1,2</group> </select> <select> <columns> customer.occupation <alias name='source'/>, customer.member_card <alias name='target'/>, count(*) <alias name='value'/> </columns> <from table='sales_fact_month_customer'> <join table='customer'> <on>sales_fact_month_customer.customer_id = customer.customer_id</on> </join> </from> <where> the_year = ${the_year} </where> <group>1,2</group> </select> </union>
5.2 Customers birthday calendar
5.2.1 Object
<select-one>$THE_DATE <alias name='the_date' /></select-one>
internal-xsqlselect-unnamed (customer_calendar) | |
---|---|
Label | Description |
5.2.2 Graphs
Calendar Box
XML
<select prefix='m_'> <columns> MDY(MONTH(customer.birthdate),DAY(customer.birthdate),YEAR(TODAY)) time_in, customer.customer_id, customer.fullname <alias name='fullname' />, customer.country <alias name='class_description' />, 0 <alias name='event_allday' />, YEAR(TODAY) - YEAR(customer.birthdate) <alias name='the_description' />, CASE WHEN customer.country = 'Canada' THEN 'rgb(33, 150, 243)' WHEN customer.country = 'Mexico' THEN 'rgb(156, 39, 176)' WHEN customer.country = 'USA' THEN 'rgb(244, 67, 54)' ELSE 'rgb(0,0,0)' END event_color </columns> <from table='customer' /> <where> MDY(MONTH(customer.birthdate),DAY(customer.birthdate),YEAR(TODAY)) BETWEEN TODAY -7 AND TODAY + 7 </where> </select>