Date: Thu, 28 Mar 2024 17:02:21 -0600 (MDT) Message-ID: <601874121.2651.1711666941621@confluence-external-wiki> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2650_1811996341.1711666941621" ------=_Part_2650_1811996341.1711666941621 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
= span>
The Javascript API must be included before any API calls can be made:
&= lt;script src=3D"http://localhost/JsAPI" type=3D"text/javascript"></s= cript>
A specific version of the API may be requested using the version=
code> parameter:
&= lt;script src=3D"http://localhost/JsAPI?version=3D2.1" type=3D"text/javascr= ipt"></script>
If the browser is unable to load the API, any calls to load reports or d=
ashboards will fail. If you wish to detect whether the API has loaded succe=
ssfully, you should check the variable window.yellowfin
is ava=
ilable:
&= lt;script src=3D"http://localhost/JsAPI" type=3D"text/javascript"></s= cript> <script type=3D"text/javascript"> if (!window.yellowfin) { alert('Error loading API'); } </script>
&= lt;script src=3D"http://localhost/JsAPI" type=3D"text/javascript"></s= cript> <script type=3D"text/javascript"> if (window.yellowfin) { alert('Yellowfin API loaded. Version: ' + yellowfin.apiVersion); } </script>
yellowfin.loadReport
f=
unction:=20
y= ellowfin.loadReport(options);
Options are passed to the function as a Javascript object. These include= a report identifier for the report you are loading, the elementId of the H= TML element in which to load the report (or the element itself), and other = options that alter the way the report is displayed. The available options a= re:
This example loads a report into an element specified by its universal i= d, setting some initial display options:
v= ar options =3D {}; options.reportUUID =3D 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63'; options.elementId =3D 'myReport'; options.showFilters =3D 'false'; options.showSeries =3D 'false'; options.display =3D 'chart'; options.fitTableWidth =3D 'false'; yellowfin.loadReport(options);
This example does the same thing with an anonymous options object:
y= ellowfin.loadReport({ reportUUID: 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', elementId: 'myReport', showFilters: 'false', showSeries: 'false', display: 'chart', fitTableWidth: 'false' });
This example passes the element directly rather than just its id:
y= ellowfin.loadReport({ reportUUID: 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', element: document.getElementById('myReport') });
yellowfin=
.reports.loadReportFilters
function. To use this function, load the =
reports sub-API into your page along with the main API:=20
&= lt;script src=3D"http://localhost/JsAPI" type=3D"text/javascript"></s= cript> <script src=3D"http://localhost/JsAPI?api=3Dreports" type=3D"text/javasc= ript"></script>
Then call the loadReportFilters
function:
y= ellowfin.reports.loadReportFilters(reportId, callback, arg);
The first argument is the unique identifier for the report, which may ei=
ther be a reportUUID
or a reportId
. We recommend =
using the reportUUID
where possible. The second argument is a =
callback function that will be called by the API when the filters for the r=
eport have been loaded. The first argument to the callback function will be=
the list of filters in the report. The second argument to the callback fun=
ction will be the third argument supplied to the loadReportFilters function (if specified).
The filters object returned as the first argument to the callback functi= on is an array containing any filters used in the report. Each element in t= he array is an object containing information about that filter. These filte= r objects contain the properties:
This example loads the report filters and displayed them to the user:
f= unction filterCallback(filters) { for (var i =3D 0; i < filters.length; i++) { alert('Filter ' + filters[i].description + ' (' + filters[i].filterUUID + '), display style: ' + filters[i].display); } } yellowfin.reports.loadReportFilters( 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', filterCallback);
This function can be used to load the available filters, and then pass t=
hem back to the loadReport
function to set up initial filter v=
alues for the report when it is loaded into the page. For example:
f= unction filterCallback(filters) { var filterValues =3D {}; for (var i =3D 0; i < filters.length; i++) { if (filters[i].description =3D=3D 'Country') { filterValues[filters[i].filterUUID] =3D 'Australia'; } else if (filters[i].description =3D=3D 'Start Date') { filterValues[filters[i].filterUUID] =3D '2011-01-01'; } else if (filters[i].description =3D=3D 'Invoiced Amount') { filterValues[filters[i].filterUUID] =3D 6400; } } // set up other options to load the report var options =3D {}; options.reportUUID =3D 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63'; options.elementId =3D 'myReport'; // add the filter values options.filters =3D filterValues; // load the report yellowfin.loadReport(options); } yellowfin.reports.loadReportFilters( 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', filterCallback);
Filter values passed to the loadReport
function should be s=
pecified as simple values as above. If the filter is a list style, multiple=
values can be set using an array:
f= ilterValues[filterUUID] =3D ['Australia', 'China', 'Italy'];
If the filter is a between style, the start and end values should be set= using an array:
f= ilterValues[filterUUID] =3D [500, 600];
The options.filters
element passed to the loadReport<=
/code> function should contain values keyed either by
filterUUID or
filterId
. We recommend using filterUUID
whe=
re possible.
yellowfin.loadDash
=
function:=20
y= ellowfin.loadDash(options);
Options are passed to the function as a Javascript object. These include= an identifier for the dashboard you are loading, the elementId of the HTML= element in which to load the dashboard (or the element itself), and other = options that alter the way the dashboard is displayed. The available option= s are:
This example loads a dashboard into an element specified by its id, sett= ing some initial display options.
v= ar options =3D {}; options.dashUUID =3D '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9'; options.elementId =3D 'myDash'; options.showFilters =3D 'false'; options.showExport =3D 'false'; yellowfin.loadDash(options);
This example does the same thing with an anonymous options object:
y= ellowfin.loadDash({ dashUUID: '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9', elementId: 'myDash', showFilters: 'false', showExport: 'false' });
This example passes the element directly, rather than just its id:
y= ellowfin.loadDash({ dashUUID: '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9', element: document.getElementById('myDash') });
yellow=
fin.dash.loadDashFilters
function. To use this function, load the da=
shboard sub-API into your page along with the main API:=20
&= lt;script src=3D"http://localhost/JsAPI" type=3D"text/javascript"></s= cript> <script src=3D"http://localhost/JsAPI?api=3Ddash" type=3D"text/javascrip= t"></script>
Then call the loadDashFilters
function:
y= ellowfin.dash.loadDashFilters(dashUUID, callback, arg);
The first argument is the unique identifier for the dashboard. The secon=
d is a callback function that will be called by the API when the filters fo=
r the dashboard have been loaded. The first argument to the callback functi=
on will be the list of filters in the dashboard. The second argument to the=
callback function will be the third argument supplied to the loadRep=
ortFilters
function (if specified).
The filters object returned as the first argument to the callback functi= on is an array containing any analytical filters used in the dashboard, as = well as filter group separators. Each element in the array is an object con= taining information about that filter or filter group. These objects contai= n the properties:
This example loads the dashboard filters and displays them to the user:<= /p>
f= unction filterCallback(filters) { for (var i =3D 0; i < filters.length; i++) { alert('Filter ' + filters[i].description + ' (' + filters[i].key + '), display style: ' + filters[i].display); } } yellowfin.reports.loadReportFilters(1234, filterCallback);
This function can be used to load the available filters, and then pass t=
hem back to the loadDash
function to set up initial filter val=
ues for the dashboard when it is loaded into the page:
f= unction filterCallback(filters) { var filterValues =3D {}; for (var i =3D 0; i < filters.length; i++) { if (filters[i].description =3D=3D 'Country') { filterValues[filters[i].key] =3D 'Australia'; } else if (filters[i].description =3D=3D 'Start Date') { filterValues[filters[i].key] =3D '2011-01-01'; } else if (filters[i].description =3D=3D 'Invoiced Amount') { filterValues[filters[i].key] =3D 6400; } } // set up other options to load the dashboard var options =3D {}; options.dashUUID =3D '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9'; options.elementId =3D 'myDash'; // add the filter values options.filters =3D filterValues; // load the dashboard yellowfin.loadDash(options); } yellowfin.dash.loadDashFilters('3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9', filt= erCallback);
Filter values passed to the loadDash
function should be spe=
cified as simple values as above. If the filter is a list style, multiple v=
alues can be set using an array:
f= ilterValues[key] =3D ['Australia', 'China', 'Italy'];
If the filter is a between style, the start and end values should be set= using an array:
f= ilterValues[key] =3D [500, 600];
The options.filters
element passed to the loadDash function should contain values keyed by the
keys
returned=
from the loadDashFilters
function.