[PowerBI - Embedded Reports] How to get this working on mobile app?

Forge Component
(0)
Published on 2019-10-20 by William Antunes
0 votes
Published on 2019-10-20 by William Antunes

Thanks very much for the component. Got it working on web. 


How to get this working on mobile app?


Currently, the web block cannot be used in mobile app. I tried to create from scratch and found out the expression in mobile app does not have "escape" option.


Could you please guide me how to get this working on mobile?


Much appreciated.

George

Hi George,

To accomplish escape content in mobile you need to use javascript widget with something like this>

document.getElementById($parameters.ContainerId).innerHTML = $parameters.Content

If you still need some help let me know.

Regards,

Marcelo

Hi Marcelo,

Unfortunately, I couldn't get the mobile app working. I get the below error:


It seems the error is coming from the powerbi-client v2.2.3 javascript, as I copied from your web block to mobile app.


It would be good if you can share a mobile app demo, just like what you have done for the desktop demo.


Much appreciated for your help.


Regards,

George


Solution

OK, got it working now.


Basically, I followed the official example from: https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#

1, copy javascript code from: https://github.com/microsoft/PowerBI-JavaScript/blob/master/dist/powerbi.js and put it into mobile module.


2. reference this JavaScript in the "Required Scripts" in the mobile page


3. In the mobile page, create a client action and use the JavaScript component and write the code:


4. dont forget your page should have a container with the name matched your javascript code , as shown above

var embedContainer = document.getElementById('<your custom container name>');


5. deploy and run. it should work



Forgot to mention, those token and url etc, you need to call the server action coming from the module PowerBI_IS

Solution

Hi,


I followed all the steps mentioned above but got error, "Cannot read property models of Undefined".

Please help me with this issue.


Regards,

Shivani

Shivani Jindal wrote:

Hi,


I followed all the steps mentioned above but got error, "Cannot read property models of Undefined".

Please help me with this issue.


Regards,

Shivani

 Hi Shivani,

I had the same error. Turns out, I did not create the PBIClient JS script, as @George Qiao stated above (step 1). After creating it and following step 2, I was able to run the dashboard in my application.

Hope this helped.

Best regards,

Tânia