cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
password
Frequent Visitor

Not able to load Image path from Database

Hi All, I have uploaded a photo into the media folder, and if I just assign my image name to Image Property, I can see my photo, the name is 2016-11-23:

Image 3.png

 

Then I have a table Photo and with one column imagepath, I use First() function to get the first one, which is also '2016-11-23', as you can see:

Image 1.png

 

The auto-complete thing already detected that the value of my formula is equal to '2016-11-23' which is what I expected too, but  I'm not able to see the photo itself in my photo control... How to solve it?

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @password ,

Could you please share a bit more about your scenario?

Do you want to retrieve the image name from your SQL Table, and then display the matching image data from the Media folder in your app within the Image control automatically?

 

Based on the issue that you mentioned, I think there is something wrong with your operation. When you retrieve the image name (imagepath column) from your SQL Table, the imagepath column value would be recognized as Text String value rather than existing uploaded media name.

 

If you want to retrieve the image name from your SQL Table, and then display the matching image data from the Media folder in your app within the Image control automatically, I afraid that there is no way to achieve your needs in PowerApps currently.

 

As an alternative solution, I think the If function could achieve your needs. Please set the Image property of the Image control to following:

If(
   First('[dbo].[Photo]').imagepath = "2016-11-23",
   '2016-11-23',   // Specify corresponidng uploaded media name here
   First('[dbo].[Photo]').imagepath = "2016-11-24",
   '2016-11-24',   // Specify corresponidng uploaded media name here
   ...
   ...
)

 

In addition, as an alternative solution, I think you could consider store the image files into your SQL Table, then you could reference the image data from your SQL Table directly within your canvas app.

More details about storing Image data into SQL Table, please check the following video:

https://www.youtube.com/watch?v=QnDD7jleHME

 

When you patch image data to your SQL Table, I think the Patch function could achieve your needs. Please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @password ,

Could you please share a bit more about your scenario?

Do you want to retrieve the image name from your SQL Table, and then display the matching image data from the Media folder in your app within the Image control automatically?

 

Based on the issue that you mentioned, I think there is something wrong with your operation. When you retrieve the image name (imagepath column) from your SQL Table, the imagepath column value would be recognized as Text String value rather than existing uploaded media name.

 

If you want to retrieve the image name from your SQL Table, and then display the matching image data from the Media folder in your app within the Image control automatically, I afraid that there is no way to achieve your needs in PowerApps currently.

 

As an alternative solution, I think the If function could achieve your needs. Please set the Image property of the Image control to following:

If(
   First('[dbo].[Photo]').imagepath = "2016-11-23",
   '2016-11-23',   // Specify corresponidng uploaded media name here
   First('[dbo].[Photo]').imagepath = "2016-11-24",
   '2016-11-24',   // Specify corresponidng uploaded media name here
   ...
   ...
)

 

In addition, as an alternative solution, I think you could consider store the image files into your SQL Table, then you could reference the image data from your SQL Table directly within your canvas app.

More details about storing Image data into SQL Table, please check the following video:

https://www.youtube.com/watch?v=QnDD7jleHME

 

When you patch image data to your SQL Table, I think the Patch function could achieve your needs. Please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (3,664)