Access YF Javascript API Components from inside a Javascript report

Charles Morris shared this question 2 years ago
Answered

Is it possible to access a the [context dependent] YF JavaScript API components from inside a custom JavaScript report?


Or is it restricted to CodeMode?

For example, is there a straightforward way to access the "dashboard API" component, when a report is loaded inside a dashboard?


Thanks

Replies (13)

photo
1

Hello Charles,

I am looking into this and will let you know what I find out. I hope to have an answer for you by the end of the day.

Have a marvelous Monday,

David

photo
1

Hi David,

I've found a round-about way of doing this, essentially via a function attached to the Window object, allowing me to effectively communicate back and forth between the dashboard API and a JavaScript report.

If there is an official way of doing I'd still be interested though.

Thanks

photo
1

Hi Charles,

Thank you for the update.

I'm happy to see if there is an official way, but I'd need to know more specific details about what they're trying to achieve. Can you provide details on what your goals are?

You can definitely trigger a drill throughs from within a JS chart, for example. E.g. click on an element of a JS chart and make a drill through pop up (and passing through the relevant filter values).

David

photo
1

Hi David,

The immediate requirement is to access the dasbhoard API to set dashboard filters, from within a JS chart.

If you can point me to documentation around activating drill-through with pop-up functionality that'd be great.

Thanks

Charles

photo
1

Hi Charles,

Here is a link to section of our Wiki that discusses creating Drill-Throughs with Pop-Ups, https://wiki.yellowfinbi.com/display/yfcurrent/Drill+Through+Reports#DrillThroughReports-DrillThroughwithPopupReports

Please let me know if that helps.

Thank you,

David

photo
1

Thanks David, we are familiar with the standard drill through capability. I thought you were talking about activating the same popup functionality in a JavaScript report.

photo
1

Hi Charles,

I apologize for the confusion. So I'm clear, is this a report that already exists in Yellowfin and is embedded in a webpage using the JS API? Or is it a report that is being generated with JavaScript?

David

photo
1

Hi David,

Yes, it's within a custom JavaScript report.

The question was prompted by this comment from you:


You can definitely trigger a drill throughs from within a JS chart, for example. E.g. click on an element of a JS chart and make a drill through pop up (and passing through the relevant filter values).


If it is possible to activate YF drill through from within a custom JS chart, we'd be interested in that.


Thanks

photo
1

Hi Charles,

Gotcha, sorry for the confusion. I'm working on getting some documentation/guide for you on that. Invoking a drill-though from a JS chart is a relatively recent addition to the functionality of JS chars embedded in Yellowfin.


I have not done it myself but I will ask one of our consultants about this.

I'll get you more information as soon as I have it.

David

photo
1

Hi Charles,

Sorry for the delay. The developer that I was working with was out.

i just got this back from him:

"Currently to apply a drill through via code, a developer would need to do


report.drillThrough({

filters: [{...}]//Filters to apply and row values that are needed

placement: 'POPUP'//REDIRECT

contentId: reportId/UUID to load

contentType: //Type of content

});


So they would need to know the contentId, where they wanted to place it and the filters that they need to link.


There are two (sort of three) ways that filters can be linked when dealing with drill through - Based on current filter value, hardcoded values and row/column values.


In the case of current & hardcoded values, these are going to be dependent on the value of the report at the time triggering drill through, so they should never need to be defined by a developer. If a developer wishes to overwrite them, they can - but they should only need to define the values for the row/column values.


On a report that only has one drill through child - you should be able to do this


report.drillThrough({

filters: [{...}]//row/column values to apply to the drill.

});

And have the config settings for that drill through to fill in the blanks."


Hope this helps,

David

photo
1

Thanks David, that's very interesting.

I'll try and find a use case so we can try this out.

I think you can close this ticket out for now

Cheers

Charles

photo
1

Hi David,

That works perfectly. Thank you.

Is this documented anywhere?

Cheers

Charles

photo
1

Hi Charles,

I'm glad that worked!

As far as public documentation, not that I know of. I'll see about getting something posted publicly.

Regards,

David

Leave a Comment
 
Attach a file