@@ -1717,10 +1717,10 @@ function _Visual_GetFilters() {
17171717
17181718 visual . getFilters ( )
17191719 . then ( function ( filters ) {
1720- Log . log ( filters ) ;
1720+ Log . log ( filters ) ;
17211721 } )
17221722 . catch ( function ( errors ) {
1723- Log . log ( errors ) ;
1723+ Log . log ( errors ) ;
17241724 } ) ;
17251725 } )
17261726 . catch ( function ( errors ) {
@@ -1758,7 +1758,7 @@ function _Visual_RemoveFilters() {
17581758
17591759 visual . removeFilters ( )
17601760 . catch ( function ( errors ) {
1761- Log . log ( errors ) ;
1761+ Log . log ( errors ) ;
17621762 } ) ;
17631763 } )
17641764 . catch ( function ( errors ) {
@@ -1768,4 +1768,94 @@ function _Visual_RemoveFilters() {
17681768 . catch ( function ( errors ) {
17691769 Log . log ( errors ) ;
17701770 } ) ;
1771+ }
1772+
1773+ function _Visual_ExportData_Summarized ( ) {
1774+ // Get models. models contains enums that can be used.
1775+ var models = window [ 'powerbi-client' ] . models ;
1776+
1777+ // Get a reference to the embedded report HTML element
1778+ var embedContainer = $ ( '#embedContainer' ) [ 0 ] ;
1779+
1780+ // Get a reference to the embedded report.
1781+ report = powerbi . get ( embedContainer ) ;
1782+
1783+ // Retrieve the page collection and get the visuals for the first page.
1784+ report . getPages ( )
1785+ . then ( function ( pages ) {
1786+
1787+ // Retrieve active page.
1788+ var activePage = pages . find ( function ( page ) {
1789+ return page . isActive
1790+ } ) ;
1791+
1792+ activePage . getVisuals ( )
1793+ . then ( function ( visuals ) {
1794+
1795+ // Retrieve the wanted visual.
1796+ var visual = visuals . find ( function ( visual ) {
1797+ return visual . name == "VisualContainer3" ;
1798+ } ) ;
1799+
1800+ // Exports visual data
1801+ visual . exportData ( models . ExportDataType . Summarized )
1802+ . then ( function ( data ) {
1803+ Log . log ( data ) ;
1804+ } )
1805+ . catch ( function ( errors ) {
1806+ Log . log ( errors ) ;
1807+ } ) ;
1808+ } )
1809+ . catch ( function ( errors ) {
1810+ Log . log ( errors ) ;
1811+ } ) ;
1812+ } )
1813+ . catch ( function ( errors ) {
1814+ Log . log ( errors ) ;
1815+ } ) ;
1816+ }
1817+
1818+ function _Visual_ExportData_Underlying ( ) {
1819+ // Get models. models contains enums that can be used.
1820+ var models = window [ 'powerbi-client' ] . models ;
1821+
1822+ // Get a reference to the embedded report HTML element
1823+ var embedContainer = $ ( '#embedContainer' ) [ 0 ] ;
1824+
1825+ // Get a reference to the embedded report.
1826+ report = powerbi . get ( embedContainer ) ;
1827+
1828+ // Retrieve the page collection and get the visuals for the first page.
1829+ report . getPages ( )
1830+ . then ( function ( pages ) {
1831+
1832+ // Retrieve active page.
1833+ var activePage = pages . find ( function ( page ) {
1834+ return page . isActive
1835+ } ) ;
1836+
1837+ activePage . getVisuals ( )
1838+ . then ( function ( visuals ) {
1839+
1840+ // Retrieve the wanted visual.
1841+ var visual = visuals . find ( function ( visual ) {
1842+ return visual . name == "VisualContainer3" ;
1843+ } ) ;
1844+
1845+ // Exports visual data
1846+ visual . exportData ( models . ExportDataType . Underlying )
1847+ . then ( function ( data ) {
1848+ Log . log ( data ) ;
1849+ } )
1850+ . catch ( function ( errors ) {
1851+ Log . log ( errors ) ;
1852+ } ) ;
1853+ } )
1854+ . catch ( function ( errors ) {
1855+ Log . log ( errors ) ;
1856+ } ) ;
1857+ } )
1858+ . catch ( function ( errors ) {
1859+ Log . log ( errors ) ;
1860+ } ) ;
17711861}
0 commit comments