is there a way to call `getObjectDetails` or somet...
# gooddata-ui
h
is there a way to call
getObjectDetails
or something equivalent in an
onDrill
? i need to return more than just labels and values without exposing that extra data in the chart… TIA
j
Hello @hunger regnuh! Could you please describe your use-case in a bit more detail, maybe post some code snippet? I assume you mean onDrill as described here? The callback function receives a JSON object with
executionContext
and
drillContext
. These should contain all the information about the drill event you would need. In this callback feel free to grab anything useful and call as many other API endpoints as you wish… What exactly are you trying to achieve?
h
yep, that’s what i’m using,
Copy code
drillableItems: [
        HeaderPredicates.objMatch(this.goodData?.catalog?.ProjectName),
        HeaderPredicates.objMatch(this.catalog.YTDEarnedValue),
        HeaderPredicates.objMatch(this.catalog.YTDExpectedCost),
      ],
      onDrill: (event: IDrillEvent) => {
        const projectName =
          !!event?.drillContext?.points && !!event?.drillContext?.points[1]
            ? event?.drillContext?.points[1]?.intersection[1]?.header['attributeHeaderItem']?.uri
            : event?.drillContext?.intersection[1]?.header['attributeHeaderItem']?.uri;
        this.onProjectDrill.emit(projectName);
        return false;
      },
what i also need though is the ID of the project (or any other entity that was clicked on) and i don’t want to expose the ID to the user
seems like, only the measures/attributes used in the chart are returned, is there a way to say “also include these attributes on drill”?
j
Hm, I see 🤔 Only measures/attributes used in the chart are returned as the drill functionality cannot possibly know what else you'd like returned. Could this be resolved by adding another label? Let's assume that there's an attribute
project
and it has label
projectTitle
that gets exposed to the user in the chart, and also label
projectId
that is NOT exposed in the chart. Could you look up the
projectId
based on the
projectTitle
inside the callback function? Another scenario, you could grab the original execution payload (measures/attributes), add your desired EXTRA attribute, and then execute again programatically and read the extra added attribute.
h
let me see if i can figure out the label way of doing it - right now we’re doing the lookup in the callback, was hoping to save a step though, especially if
getObjectDetails
is exposed 😄 i’ll add a feature request
👌 1
thanks for the help 😄 it’s much appreciated
👍 1