cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesM
Helper V
Helper V

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

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

 

View solution in original post

2 REPLIES 2
JamesM
Helper V
Helper V

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

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,261)