In this section table reports will be described for Foodmart
on its wic wic_demo_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 reports do and to what tables they are related to.
Object | Tag | Title | Render Type | Type of object | Ordered by | Tables related | Description |
---|---|---|---|---|---|---|---|
store_analytics_list | Sales Report | SALES REPORT | Report | READ ONLY |
time_by_day.the_date , store.store_name , store.store_type , product_class.product_subcategory
|
sales_fact , store , time_by_day , product , product_class
|
Report of sales, costs, unit sales and profits by store and product subcategory. |
annual_report_print | Annual Report | ANNUAL REPORT | Form singlerow | READ ONLY |
annual_report_data_lbl
|
Printable report of annual sales, costs and profits. |
All this atributes are modified in the Objects wic.
To learn more about Object definitions check Developement Guide
> Views > Objects.
2 Sales Report
Foodmart
only has one table report which classifies by store and product subcategory the units sold, sales, cost and profit by asking from what range of dates at the start. See more about reports in Business Reports in Developement Guide
> Objects.
XML
3 Annual Report print
This printable report includes graphs and modifiable lables in order to make it more personalized to the client. It uses the table annual_report_data_lbl
to store headers, labels and texts.
See more about report prints in the section Print in Developement Guide
> Views > Objects.
3.1 Object
XML
3.2 Graphs
3.2.1 SQL Table
Type: Supertable
XML
<select first='15'> <columns> store.store_id, store.store_name || ' (' || store.store_city || ')' store_name, <!--g.unit_sales,--> row('ball', 'Units', 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, sfms.sales, row('vbar colored', '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,(select Max(abs(a.sales_pct)) from sales_fact_month_store a)) sales_perc, 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', 'cost', (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 </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>
Type: Supertable
XML
<select first='10'> <columns> product_total_sales.product_id, product.product_name, product_class.product_subcategory, product_class.product_family, product_total_sales.product_profit product_profit, product_total_sales.product_unit_sales unit_sales, row('percent', 'Total', product_total_sales.product_unit_sales, 0, (SELECT MAX(product_unit_sales) FROM product_total_sales)) unit_sales_perc, row('mm', 'dif', (product_total_sales.product_unit_sales - product_total_sales.product_unit_sales_prev), 0, 400) unit_sales_prv </columns> <from table='product_total_sales'> <join table='product'> <on>product_total_sales.product_id = product.product_id</on> <join table='product_class'> <on>product.product_class_id = product_class.product_class_id</on> </join> </join> </from> <order>5 DESC</order> </select>
Type: Supertable
XML
<select first='10'> <columns> product_total_sales.product_id, product.product_name, product_class.product_subcategory, product_class.product_family, product_total_sales.product_profit, product_total_sales.product_unit_sales unit_sales, row('percent', 'Total', product_total_sales.product_unit_sales, 0, (SELECT MAX(product_unit_sales) FROM product_total_sales)) unit_sales_perc, row('mm', 'dif', (product_total_sales.product_unit_sales - product_total_sales.product_unit_sales_prev), 0, 400) unit_sales_prv </columns> <from table='product_total_sales'> <join table='product'> <on>product_total_sales.product_id = product.product_id</on> <join table='product_class'> <on>product.product_class_id = product_class.product_class_id</on> </join> </join> </from> <where> product_total_sales.product_unit_sales IS NOT NULL </where> <order>5</order> </select>
Type: Supertable
XML
<select first='10'> <columns> customer.customer_id, customer.fullname, customer.city, customer.member_card, row('percent', 'Years', (time_by_day.the_year-YEAR(customer.date_accnt_opened)), 0, 10) years, (SUM(sales_fact.store_sales)-SUM(sales_fact.store_cost)) customer_profit, SUM(sales_fact.store_sales) sales, SUM(sales_fact.unit_sales) unit_sales </columns> <from table='customer'> <join table='sales_fact'> <on>customer.customer_id = sales_fact.customer_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,4,5</group> <order>6 desc</order> </select>
3.2.2 SQL JChart
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: Pie
XML
<select> <columns> store.store_type, (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> <join table='store'> <on>sales_fact.store_id = store.store_id</on> </join> </from> <where> time_by_day.the_year = ${the_year} </where> <group>1</group> <order>1</order> </select>
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_day.quarter, SUM(sales_fact.store_sales) sales </columns> <from table='sales_fact'> <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>2</order> </select> </vtable> <return><vtable.pivot name='v_out' pivotcolumns='store_type' pivotsort='quarter' datacolumns='sales' /></return> </body> </xsql-script> ]] > </call>
Type: Cartesian
XML
<union type='all' intotemp='@tmp1'> <select> <columns> customer.yearly_income, NVL((SUM(sales_fact.store_sales))-(SUM(sales_fact.store_cost)),0) store_profit_m, 0 store_profit_f </columns> <from table='sales_fact'> <join table='customer'> <on>sales_fact.customer_id = customer.customer_id</on> </join> <join table='time_by_day' > <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> customer.gender = 'M' AND time_by_day.the_year = ${the_year} </where> <group>1</group> </select> <select> <columns> customer.yearly_income, 0 store_profit_m, NVL((SUM(sales_fact.store_sales))-(SUM(sales_fact.store_cost)),0) store_profit_f </columns> <from table='sales_fact'> <join table='customer'> <on>sales_fact.customer_id = customer.customer_id</on> </join> <join table='time_by_day' > <on>sales_fact.time_id = time_by_day.time_id</on> </join> </from> <where> customer.gender = 'F' AND time_by_day.the_year = ${the_year} </where> <group>1</group> </select> </union> <select> <columns> yearly_income, SUM(store_profit_m) store_profit_m, (SUM(store_profit_f) * -1) store_profit_f </columns> <from table='@tmp1'/> <group>1</group> <order>2 desc</order> </select>