Use Google's gson conversion to verify online availability. The example is from saiku-foodmart.
PS: This document is written backwards, so you should first read 2 and then read 1...
1. First, cube and shared dimension:
PS: The related code is in the com. XXX. schema package.
Taking Cube: sales 2 as an example, this cube contains the preceding content. Each cube is encapsulated as a JSON
For the full version, see appendix 2.
Formatted (excerpt ):
{
"Cubename": "sales 2 ",
"Cuniquename": "[sales 2]",
"Ccaption": "sales2", // The meanings of these three items are the same as the comments in 2.
"Dimensions": [// dimensions contained in this cube
{
"Dimenname": "time ",
"Duniquename": "[time]",
"Dcaption": "time", // The name attributes are all three
"Hierarchies": [// hierarchy in this dimension
{
"Hierarchyname": "time ",
"Huniquename": "[time]",
"Hcaption": "time ",
"Levels": [// level in Hierarchy
{
"Levelname": "year ",
"Luniquename": "year ",
"Lcaption": "year ",
"Depth": 0
// Depth: the depth of level. The smaller the value range, the larger the value range. For example, 0 indicates all.
}
......
]
},
{
"Hierarchyname": "Time. Weekly ",
......
}
]
}
......
],
"Measures ":[
{
"Measurename": "sales count ",
"Muniquename": "[measures]. [sales count]",
"Mcaption": "sales count"
}
......
]
}
The structure of the shared dimension is similar to that of the demo version. For an example, see Appendix 3.
PS: For the code for generating the MDX statement, see package com. XXX. MDX,
The data format that the front end needs to pass to the backend. For details, refer to the long comments at the beginning of each type.
2. Then the query result (cell ):
PS: The related code is in the com. XXX. Result package.
Select Cube: Sales and drag the following conditions:
Each line encapsulates a JSON file. For the complete example, see Appendix 1 below:
Take the first cell in the first row and format it (top left, coordinate 0, 0)
{
"Value": "$22,553.64", // cell value
"Coordrow": 0, // line coordinate
"Coordcolumn": 0, // column Coordinate
"Columns": [// the header of the column (multiple layers may exist)
{
"Cname": "ca ",
"Cuniquename": "[Customers]. [USA]. [Ca]",
"Ccaption": "ca"
},
{// This is the second header.
"Cname": "F ",
"Cuniquename": "[gender]. [f]",
"Ccaption": "F"
}
],
"Rows": [// header on the row (in this example, there is only one header)
{
"Rname": "profit ",
"Runiquename": "[measures]. [profit]",
"Rcaption": "profit"
}
]
}
Column and row have three attributes:
-Name: abbreviation, such as F
-Uniquename: full name, for example, [gender]. [F]
-Caption: The name displayed on the page, such as "female". The default value is the same as-name.
Appendix 1:
In the first line:
[{"Value": "$22,553.64", "coordrow": 0, "coordcolumn": 0, "columns": [{"cname": "ca ", "cuniquename": "[MERs]. [USA]. [Ca] "," ccaption ":" ca "}, {" cname ":" F "," cuniquename ":" [gender]. [f] "," ccaption ":" F "}]," rows ": [{" rname ":" profit "," runiquename ":" [measures]. [profit] "," rcaption ":" profit "}] },{" value ":" $22,911.70 "," coordrow ": 0," coordcolumn ": 1, "columns": [{"cname": "ca", "cuniquename": "[MERs]. [USA]. [Ca] "," ccaption ":" ca "}, {" cname ":" M "," cuniquename ":" [gender]. [m] "," ccaption ":" M "}]," rows ": [{" rname ":" profit "," runiquename ":" [measures]. [profit] "," rcaption ":" profit "}] },{" value ":" $22,361.31 "," coordrow ": 0," coordcolumn ": 2, "columns": [{"cname": "or", "cuniquename": "[MERs]. [USA]. [or] "," ccaption ":" or "},{" cname ":" F "," cuniquename ":" [gender]. [f] "," ccaption ":" F "}]," rows ": [{" rname ":" profit "," runiquename ":" [measures]. [profit] "," rcaption ":" profit "}] },{" value ":" $23,334.58 "," coordrow ": 0," coordcolumn ": 3, "columns": [{"cname": "or", "cuniquename": "[MERs]. [USA]. [or] "," ccaption ":" or "},{" cname ":" M "," cuniquename ":" [gender]. [m] "," ccaption ":" M "}]," rows ": [{" rname ":" profit "," runiquename ":" [measures]. [profit] "," rcaption ":" profit "}] },{" value ":" $39,174.49 "," coordrow ": 0," coordcolumn ": 4, "columns": [{"cname": "wa", "cuniquename": "[MERs]. [USA]. [wa] "," ccaption ":" wa "},{" cname ":" F "," cuniquename ":" [gender]. [f] "," ccaption ":" F "}]," rows ": [{" rname ":" profit "," runiquename ":" [measures]. [profit] "," rcaption ":" profit "}] },{" value ":" $37,907.41 "," coordrow ": 0," coordcolumn ": 5, "columns": [{"cname": "wa", "cuniquename": "[MERs]. [USA]. [wa] "," ccaption ":" wa "},{" cname ":" M "," cuniquename ":" [gender]. [m] "," ccaption ":" M "}]," rows ": [{" rname ":" profit "," runiquename ":" [measures]. [profit] "," rcaption ":" profit "}]
Row 2:
[{"Value": "37,480.50", "coordrow": 1, "coordcolumn": 0, "columns": [{"cname": "ca", "cuniquename ": "[MERs]. [USA]. [Ca] "," ccaption ":" ca "}, {" cname ":" F "," cuniquename ":" [gender]. [f] "," ccaption ":" F "}]," rows ": [{" rname ":" storesales "," runiquename ":" [measures]. [storesales] "," rcaption ":" storesales "}] },{" value ":" 38,088.75 "," coordrow ": 1," coordcolumn ": 1, "columns": [{"cname": "ca", "cuniquename": "[MERs]. [USA]. [Ca] "," ccaption ":" ca "}, {" cname ":" M "," cuniquename ":" [gender]. [m] "," ccaption ":" M "}]," rows ": [{" rname ":" storesales "," runiquename ":" [measures]. [storesales] "," rcaption ":" storesales "}] },{" value ":" 37,230.43 "," coordrow ": 1," coordcolumn ": 2, "columns": [{"cname": "or", "cuniquename": "[MERs]. [USA]. [or] "," ccaption ":" or "},{" cname ":" F "," cuniquename ":" [gender]. [f] "," ccaption ":" F "}]," rows ": [{" rname ":" storesales "," runiquename ":" [measures]. [storesales] "," rcaption ":" store sales "}] },{" value ":" 38,820.32 "," coordrow ": 1," coordcolumn ": 3, "columns": [{"cname": "or", "cuniquename": "[MERs]. [USA]. [or] "," ccaption ":" or "},{" cname ":" M "," cuniquename ":" [gender]. [m] "," ccaption ":" M "}]," rows ": [{" rname ":" storesales "," runiquename ":" [measures]. [storesales] "," rcaption ":" storesales "}] },{" value ":" 65,063.54 "," coordrow ": 1," coordcolumn ": 4, "columns": [{"cname": "wa", "cuniquename": "[MERs]. [USA]. [wa] "," ccaption ":" wa "},{" cname ":" F "," cuniquename ":" [gender]. [f] "," ccaption ":" F "}]," rows ": [{" rname ":" storesales "," runiquename ":" [measures]. [storesales] "," rcaption ":" storesales "}] },{" value ":" 63,216.70 "," coordrow ": 1," coordcolumn ": 5, "columns": [{"cname": "wa", "cuniquename": "[MERs]. [USA]. [wa] "," ccaption ":" wa "},{" cname ":" M "," cuniquename ":" [gender]. [m] "," ccaption ":" M "}]," rows ": [{" rname ":" storesales "," runiquename ":" [measures]. [storesales] "," rcaption ":" store sales "}]
Appendix 2: Cube -- sales 2
{"Cubename": "sales2", "cuniquename": "[sales2]", "ccaption": "sales2", "dimensions": [{"dimenname ": "time", "duniquename": "[time]", "dcaption": "time", "hierarchies": [{"hierarchyname": "time", "huniquename ": "[time]", "hcaption": "time", "levels": [{"levelname": "year", "luniquename": "year", "lcaption ": "year", "depth": 0 },{ "levelname": "quarter", "luniquename": "quarter", "lcaption": "quarter", "depth ": 1 },{ "levelname": "month", "luniquename": "month", "lcaption": "month", "depth": 2}]}, {"hierarchyname": "time. weekly "," huniquename ":" [time. weekly] "," hcaption ":" Weekly "," levels ": [{" levelname ":" (all) "," luniquename ":" (all )", "lcaption": "(all)", "depth": 0 },{ "levelname": "year", "luniquename": "year", "lcaption ": "year", "depth": 1 },{ "levelname": "Week", "luniquename": "Week", "lcaption": "Week", "depth ": 2 },{ "levelname": "day", "luniquename": "day", "lcaption": "day", "depth": 3}]}, {"dimenname": "product", "duniquename": "[product]", "dcaption": "product", "hierarchies": [{"hierarchyname ": "product", "huniquename": "[product]", "hcaption": "product", "levels": [{"levelname": "(all )", "luniquename": "(all)", "lcaption": "(all)", "depth": 0 },{ "levelname": "productfamily", "luniquename ": "productfamily", "lcaption": "productfamily", "depth": 1 },{ "levelname": "productdepartment", "luniquename": "productdepartment", "lcaption ": "product department", "depth": 2 },{ "levelname": "productcategory", "luniquename": "productcategory", "lcaption": "productcategory ", "depth": 3 },{ "levelname": "productsubcategory", "luniquename": "productsubcategory", "lcaption": "productsubcategory", "depth": 4 }, {"levelname": "BrandName", "luniquename": "BrandName", "lcaption": "BrandName", "depth": 5 },{ "levelname ": "productname", "luniquename": "productname", "lcaption": "productname", "depth": 6}]}, {"dimenname": "gender ", "duniquename": "[gender]", "dcaption": "gender", "hierarchies": [{"hierarchyname": "gender", "huniquename ": "[gender]", "hcaption": "gender", "levels": [{"levelname": "(all)", "luniquename": "(all )", "lcaption": "(all)", "depth": 0 },{ "levelname": "gender", "luniquename": "gender", "lcaption ": "gender", "depth": 1}], "Measures": [{"measurename": "salescount", "muniquename": "[measures]. [salescount] "," mcaption ":" salescount "},{" measurename ":" unitsales "," muniquename ":" [measures]. [unitsales] "," mcaption ":" unitsales "},{" measurename ":" storesales "," muniquename ":" [measures]. [storesales] "," mcaption ":" storesales "},{" measurename ":" storecost "," muniquename ":" [measures]. [storecost] "," mcaption ":" storecost "},{" measurename ":" customercount "," muniquename ":" [measures]. [customercount] "," mcaption ":" customercount "},{" measurename ":" profit "," muniquename ":" [measures]. [profit] "," mcaption ":" profit "}, {" measurename ":" profitlast period "," muniquename ":" [measures]. [profit lastperiod] "," mcaption ":" profit last period "}]}
Appendix 3:Shared dimension
{"Sharedname": "storetype", "suniquename": "[storetype]", "scaption": "store type", "hierarchies": [{"hierarchyname ": "storetype", "huniquename": "storetype", "hcaption": "storetype", "levels": [{"levelname": "(all)", "luniquename ": "[storetype]. [(all)] "," lcaption ":" (all) "," depth ": 0 },{" levelname ":" storetype "," luniquename ": "[store type]. [storetype] "," lcaption ":" storetype "," depth ": 1}]}
Project notes -- 9.21