cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesM
Level 8

Unable to get Image control which derives the image from a URL to update within the APP

I have an image control in a test app, where the image is derived from a URL, e.g. 

 

Image = ("https://s3-ap-southeast-2.amazonaws.com/api-dev-jupyter-notebook-s3/graph_sales.png")

 

I am working on a solution that allows that image to be updated (while retaining the same file name). Now in my mind, this should allow the image reference to either 

 

a) automatically update

b) Be able to update via a button click or timer. I've tried a button that sets this image to the same URL again, and a timer where the timer end sets the image controls image property to the same URL again (after the image has been updated).  Unfortunately, the image doesn't update. Not unless I quit out of the app and re-launch (or possibly navigate to a different screen and back again, I haven't tested that).  Is this simply not possible in PowerApps, or am I missing something? There's no 'refresh' command for an image sadly. 

 

If I can get this to work, then I have a way to dynamically generate some really interesting and cool graphs, and wanted to do a tutorial on it, but without this piece of the puzzle, it's essentially useless. 

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: Unable to get Image control which derives the image from a URL to update within the APP

Hi @JamesM,

It looks like you want to use the same URL, update it, and see a different result. The problem you're encountering is the content from the URL is caching. 

 

So you need a way to tell PowerApps "I have a new version of this same URL."

 

Here's how I would do it today:

  1. Show the image in image box, Image1.
  2. Have a button that updates the Image, ex:
    Set(image,AzureBlobStorage.UpdateFile(test.Id,AddMediaButton1.Media));
  3. Make the same button reset a variable at the same time that it updates an image
    Set(wait,true);
    Set(image,AzureBlobStorage.UpdateFile(test.Id,AddMediaButton1.Media));
    Set(wait,false)
    Since the variable is flipping on, then off when the image is updated, we can take advantage of that.

  4. I make image appear when that variable is false again:
    If(!wait,
        image
    )

For a moment, the wait variable is true, so there's no image. At that time, the image is being updated. When the image is done updating, wait is returned to false. So the image box will attempt to show the URL again. It should be updated by then.

 

Let me know if this works for you.

 

Note: I've attached an msapp file (File > Open > Browse) . It has what I used for testing, but it's tied to Azure Blob.

image.png

 

2 REPLIES 2
Highlighted
JamesM
Level 8

Re: Unable to get Image control which derives the image from a URL to update within the APP

Anyone have any ideas? I'm super keen to write this tutorial, but it's for naught if I can't solve this part. 

PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: Unable to get Image control which derives the image from a URL to update within the APP

Hi @JamesM,

It looks like you want to use the same URL, update it, and see a different result. The problem you're encountering is the content from the URL is caching. 

 

So you need a way to tell PowerApps "I have a new version of this same URL."

 

Here's how I would do it today:

  1. Show the image in image box, Image1.
  2. Have a button that updates the Image, ex:
    Set(image,AzureBlobStorage.UpdateFile(test.Id,AddMediaButton1.Media));
  3. Make the same button reset a variable at the same time that it updates an image
    Set(wait,true);
    Set(image,AzureBlobStorage.UpdateFile(test.Id,AddMediaButton1.Media));
    Set(wait,false)
    Since the variable is flipping on, then off when the image is updated, we can take advantage of that.

  4. I make image appear when that variable is false again:
    If(!wait,
        image
    )

For a moment, the wait variable is true, so there's no image. At that time, the image is being updated. When the image is done updating, wait is returned to false. So the image box will attempt to show the URL again. It should be updated by then.

 

Let me know if this works for you.

 

Note: I've attached an msapp file (File > Open > Browse) . It has what I used for testing, but it's tied to Azure Blob.

image.png

 

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 514 members 4,558 guests
Please welcome our newest community members: