我刚刚开始使用 MDX 查询,所以我不是专家。我们已经获得了 MDX 查询,这些查询将通过 Web 套接字连接从我们的前端应用程序触发。收到的响应是一个多维数据集,而不是看起来像这样的标准 JSON。
{
"type": "cellSetData",
"streamId": "cb6fdd98-d528-44fb-8f14-366970e574b5",
"queryId": "cb6fdd98-d528-44fb-8f14-366970e574b5",
"data": {
"axes": [
{
"id":0,
"hierarchies": [
{
"dimension": "Measures",
"hierarchy": "Measures"
}
],
"positions": [
[ { "namePath": [ "5-Day ADV" ] } ],
[ { "namePath": [ "Target Value" ] } ],
[ { "namePath": [ "Performance Vs VWAP (Targ. Val. W.A.)" ] } ]
],
"maxLevelPerHierarchy": [1]
},
{
"id":1,
"hierarchies": [
{
"dimension": "Order",
"hierarchy": "OrderId"
}
],
"positions": [
[ { "namePath": [ "AllMember" ] } ],
[ { "namePath": [ "AllMember", "20180829-142357889-114-29" ] } ],
[ { "namePath": [ "AllMember", "20180829-142357896-775-32" ] } ],
[ { "namePath": [ "AllMember", "20180829-142357897-394-35" ] } ]
],
"maxLevelPerHierarchy": [2]
}
],
"cells": [
{
"ordinal": 0,
"value": 1.8702095375E7
},
{
"ordinal": 1,
"value": 41461.2
},
{
"ordinal": 2,
"value": 0.0
},
{
"ordinal": 3,
"value": 1968021.375
},
{
"ordinal": 4,
"value": 17719.2
},
{
"ordinal": 5,
"value": 0.0
},
{
"ordinal": 6,
"value": 1043997.0
},
{
"ordinal": 7,
"value": 10328.4
},
{
"ordinal": 8,
"value": 0.0
},
{
"ordinal": 9,
"value": 1.5690077E7
},
{
"ordinal": 10,
"value": 13413.6
},
{
"ordinal": 11,
"value": 0.0
}
]
}
}
- 我们是否有任何开源解析器来帮助我们获得如下 JSON 响应:
{"Stock_Percentage":"1.8702095375E7","Stock_Quantity":"21997538","Stock_Price":"333"} {"Stock_Percentage":"1968021.375","Stock_Quantity":"17719.2","Stock_Price":"0.0" }
我们是否可以在 MDX 级别进行调整以返回类似的响应,而不管聚合级别如何。
对 ActiveViam 的查询,基于 React 的 Active Pivot Live 如何解析此数据。欢迎任何 gitlinks 或参考。
我能想到的唯一粗略的方法是计算“位置”并通过“单元”上的 MOD 函数将其用作计算。这可能只是一个漫无边际的随意跳过这个。
任何信息都非常感谢!
此致!!