Yoshimori Otsuka
06/14/2023, 9:02 AM// const { result } = useInsightDataView({...})
// {
// ...
// "n2oMap": {
// "a_demo_for_gooddata_test_2.ad_name": "ce1d36d564a5474a8e31d4e246ef9e8c",
// "m_zz_dummy_cpc_group_by_ad_name": "af4b8fecc67145caaeac124fbb9da9ce"
// }
// }
const { error: originalError, status, result } = useInsightDataView({
insight: {
identifier: Insights[insightId],
},
sorts: [
// Expected
// I want to get the localIdentifier of a insight column from catalog.ts
// ex. getLocalItentifier(insitghtId, Md.AdName) -> 'ce1d36d564a5474a8e31d4e246ef9e8c'
// ex. getLocalItentifier(insitghtId, Md.ZzDummyCPC) -> 'af4b8fecc67145caaeac124fbb9da9ce'
// ex. or Md.ZzDummyCPC.sortIdentifier -> 'af4b8fecc67145caaeac124fbb9da9ce'
// for
// newAttributeSort(getLocalItentifier(insitghtId, Md.AdName), 'asc'),
// newMeasureSort(getLocalItentifier(insitghtId, Md.ZzDummyCPC), 'asc'),
// Actual
// attribute Working. I want the localIdentifier of a insight column
// newAttributeSort('ce1d36d564a5474a8e31d4e246ef9e8c', 'asc'), // n2oMap value
// meature Working. same as above
// newMeasureSort('af4b8fecc67145caaeac124fbb9da9ce', 'asc'), // n2oMap value
// Not working. Error(Invariant Violation: dangling localId reference. Target: a_demo_for_gooddata_test.ad_name)
// newAttributeSort(Md.AdName, 'asc'), // a_demo_for_gooddata_test_2.ad_name
// Not working. Error(Invariant Violation: dangling localId reference. Target: m_zz_dummy_cpc)
// newMeasureSort(ZzDummyCPC.measure., 'asc'), //
]
})
Table
Ad name, CPCMatyáš Kandl
06/14/2023, 12:08 PM(def: IExecutionDefinition) => ISortItem[])
Yoshimori Otsuka
06/15/2023, 12:56 AMdid you try to get it from the execution definition?Yes, unfortunately I get the measureOrId from he result (the execution definition) which is returned by useInsightDataView(). However, I want the measureOrId for newMeasureSort() from some getter(insightId, Md) or Md.
You can provide sorts also as a functionIs this insightSorts from gooddata/sdk-model? I can't find it well. Perhaps your function doesn't satisfies my problem (how to get measureOrId from some getter(insightId, Md) or Md?) because I want use useInsightDataView() and set sorts using
newMeasureSort
from measureOrId in my application.
ref. https://gdui-examples.herokuapp.com/execute/use-insight-data-view-hookMatyáš Kandl
06/20/2023, 8:04 AMconst { error: originalError, status, result } = useInsightDataView({
insight: {
identifier: Insights[insightId],
},
sorts: (executionDefinition) => {
// get measure local id from the execution definition
const measureLocalId = yourOwnGetterToGetMeasureLocalIdFromExecutionDefinition(executionDefinition);
return [newMeasureSort(measureLocalId, 'asc')]; // return sorts
}
})
Yoshimori Otsuka
06/21/2023, 7:24 AM