cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

React to PowerBIIntegration.Data changes in a Power App

Hi all,

I've got a Power BI report and added a Power Apps canvas app with a connected Power Automate Flow to it to save data back to the data source, and they are working together quite nicely.

 

But now I've got the following requirement:

 

  1. A user selects one or multiple rows in the Power BI report.
  2. Based on the selected data, which I get through PowerBIIntegration.Data, I need the Power App to send data to a Stored Procedure in a SQL database through a Flow whenever the user selection changes in the Power BI report.
  3. The return values from the Stored Procedure are used as items for a multi-select gallery with check boxes.

 

I managed to solve that requirement by calling the Flow in the OnSelect of a "single-select" drop down control. It was not "perfect", as the drop down's OnSelect event called the Flow, and I had to show a loading spinner as soon as the user clicked to open the drop down, but it was "acceptable".

But how do I solve that with a multi-select control, like a combo box or a gallery with check boxes? I cannot use the OnSelect event of those controls, as a user should be able to select multiple entries. So for each click it would call the Flow and show a loading spinner.

I thought about adding a "reload" button/icon next to the gallery, but I would consider that "bad design" as I as a user would expect the gallery/combo box items to update automatically when I select the entries in the Power BI report. And my end users also didn't accept that. 😉 

 

Any ideas? Is there maybe a way to solve that with a custom component (PCF)?

6 REPLIES 6
Syndicate_Admin
Administrator
Administrator

I have a powerapp visual integrated in PowerBI report.
when you select a item from report, the powerapp opens a new form or edit form checking if the row is present in SP list.
Now i have requirement to show Load and Cancel button in place of new form.
clicking on Load - i call power automate and load some values from backend and show Edit form
Clicking on Cancel - I should show NewForm.

So In My Powerapp screen i have these things
SharepointNewForm with btnSubmit
SharePointEditForm with btnUpdate
btnLoad Button
btnCancel Button

On screen visible property
I am setting a context varible UpdateContext({formNew:false})
SharepointNewForm Visible property is formNew

SharepointNewForm Visible = formNew
SharePointEditForm Visible =CountRows([@PowerBIIntegration].Data) = 1 && !IsBlankOrError(LookUp(SPList, ProjID=Text(First([@PowerBIIntegration].Data).ide)))
btnLoad visible = CountRows([@PowerBIIntegration].Data) = 1 && IsBlankOrError(LookUp(SPList, ProjID=Text(First([@PowerBIIntegration].Data).ide))) && !formNew
btnCancel visible = CountRows([@PowerBIIntegration].Data) = 1 && IsBlankOrError(LookUp(SPList, ProjID=Text(First([@PowerBIIntegration].Data).ide))) && !formNew

On Click on Cancel I do UpdateContext({formNew:true}) , Doing this hides my Load and Cancel button and shows user the SharepointNewForm

And then the problem comes here, If user selects a different row in PowerBI report , I again have to show user Load and Cancel button and hide SharepointNewForm
But this is not happening as i have set the UpdateContext({formNew:true}) onselect of Cancel button and I do not have a way to reset to false when there is onchange in [@PowerBIIntegration].Data

So I need to be able to set the formNew variable to False everytime the user is changing a selection in PowerBiReport.
But I should also be able to set formNew variable to true when user clicks Cancel

 

I used custom component with input property  binded to PowerBIIntegration].Data

And output property i set a variable like shown below

Reshma__Jain_0-1629357897706.png

 

if I use custom output property   for SharePointNewForm Visible = customProperty1.cusSetVisibilty,  I can  to set the formNew variable to False everytime the user is changing a selection in PowerBiReport. But I cannot set this to true on click of Cancel button and back to False if user changes selection in PowerBi

Syndicate_Admin
Administrator
Administrator

I know this is a bit old post, but I thought I'd share what I was able to do. It may be a bug in PowerApps, as I stumbled over this by accident, but a combo box OnChange() event is triggered by a change in PowerBIIntegration.Data change. I added a hidden one that set a few variables when it was changed and it's all working well now. 

Syndicate_Admin
Administrator
Administrator

I found a workaround/solution by creating a component. 😊

 

Steps:

  1. Create a component
  2. Add a custom input property and check "Raise OnReset when value changes"
  3. "Bind" PowerBIIntegration.Data to this property
  4. Call the Flow / Stored Procedure in the component's OnReset 
  5. Return the values in an output property
  6. "Bind" that output property to whatever control in your app

 

Doing it that way makes it a bit "chatty" as basically every selection change in the Power BI report will trigger a Flow (and thus a Stored Proedure) call, but I didn't find any other solution yet.

Would you mind explaining what you mean by "Bind" in this circumstance? I have attempted the following with no luck:

 

  • Created a new component "bi_change_detection"
    • New Custom Property: "detect_change"
    • Input, Data Type Text, Tick Raise OnReset when value changes
    • Create
  • Edit the OnReset property of the bi_change_detection component to: 
    • Set(random_number, Rand()) 
  • I add an instance of bi_change_detection to my screen
    • edit the detect_change input property to First([@PowerBIIntegration].Data).identifier_from_bi_data
  • I've added a Text Label to my screen to display the random_number variable. I expect that as I filter through the BI data (which is only selecting one identifier_from_bi_data each time, therefore the first record is also changing. This can also be seen putting First([@PowerBIIntegration].Data).identifier_from_bi_data into a text label and watching it change as I click through Power BI) this should be changing the value of my detect_change input, which should then trigger the OnChange of my bi_change_detection Component, which should assign a new random value (via Rand()) to the random_number variable, which is ultimately displayed on my screen via a Text Label.
  • This is not happening. When I change the Power BI data, the random_number variable is not being updated. 

 

"Bind" in this case means assigning PowerBIIntegration.Data to the Input property as you did.

 

Regarding your second issue, I can only assume from your description. You need to create an output property in your component and assign it the value of your random_number variable inside of the component. And then assign the output property of your component instance to your textbox on the screen.

Thanks ToHe, I appreciate the prompt response. 

 

I am still struggling to make this work. 

 

  • In my bi_change_detection component I have created an output property called action_change and set this to Rand(). my OnReset formula has been changed to bi_change_detection.action_change. 
    • The default value of the detect_change formula is just a string value. This is changed to First([@PowerBIIntegration].Data).clinician_code when added to the screen. 
  • I have tried using an input parameter (input_variable) in my action_change output formula, and setting the value of action_change to set(input_variable, Rand()) though it is telling me the value is invalid. 

The end goal I have is to be able to action the formula Reset(combo_box) where combo_box is a Combo Box on the screen, with the effect of a change in the Power BI data resulting in a change in the value of the Combo Box, even if the user has previously edited the Combo Box. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors