cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dansshin
Level: Powered On

Image name from database

I have added Employee.jpg to my media content. In an image control, if I change the Image value of that control to Employee it shows me the picture of Employee.jpg. But if I bind that Image value to datasource field which passes in text "Employee" it's not working. Error I get is:

 

The property expects image values, but this rule produces incompatible Table values.

 

Anyone know how I can resolve this?

1 ACCEPTED SOLUTION

Accepted Solutions
Meneghino
Level 10

Re: Image name from database

Hi, yes, I just did a test and it looks as though in some upgrade the urls have been modified.

 

Try to create a text box and set its Text property to Employee, no quotation marks not single , not double.

 

This should show you the URL text.

 

Does it work?

 

View solution in original post

10 REPLIES 10
Meneghino
Level 10

Re: Image name from database

Hi @dansshin

 

Once you load Emplyee.jpg into media content, then Employee is an image url in PowerApps, the text value should be this:

 

ms-appx:///ctrllib/image/images/Employee.jpg

 

So the datasource field that you are trying to bind should pass the url text as text.

 

You can see if this works by setting the image control's Image property as follows:

 

 

"ms-appx:///ctrllib/image/images/Employee.jpg"

Please note the double quotes, this is now text.

 

dansshin
Level: Powered On

Re: Image name from database

Hi Meneghino,

 

First of all thank you for your time in responding to this. 

 

I tried changing the Image property to below and it doesn't seem to be working. ImagePath includes the jpg name with the extension and these jpg files are included in the media library within PowerApps. Even tried hard coding one of the jpg names directly and still didn't work.

 

Any other ideals?

 

If(ThisItem.ImagePath = "", 'Employee', "ms-appx:///ctrllib/image/images/" & ThisItem.ImagePath)
Meneghino
Level 10

Re: Image name from database

Hi, yes, I just did a test and it looks as though in some upgrade the urls have been modified.

 

Try to create a text box and set its Text property to Employee, no quotation marks not single , not double.

 

This should show you the URL text.

 

Does it work?

 

View solution in original post

dansshin
Level: Powered On

Re: Image name from database

@Meneghino Thanks for that tip. I did that for Employee and this is what I got. However based on this I'll probably take a different route since it looks like it's given a different name. I believe Employee is PNG file so extension is correct but not sure how it got to name of 0004 instead of Employee. 

 

ms-appdata:///local/Resources/Assets/Images/0004.png

Meneghino
Level 10

Re: Image name from database

OK, no problem, at least you know how to refer to locally stored images dynamically

dansshin
Level: Powered On

Re: Image name from database

@Meneghino Even with the correct string value in the Image property it doesn't seem to be pulling the image. Is there a function that could convert this string to Image?

Meneghino
Level 10

Re: Image name from database

@dansshin

That is strange, it is working fine for me.  Here is what I did:

0) Create a new blank app

1) Upload Duomo.jpg to PowerApps

2) Insert a text box and set Text = Duomo

3) Copy the resulting URL (including spaces etc)

4) Insert an image control and set Image = "ms-appdata:///local/Resources (22)/Assets/Images/0001.jpg"

Result below:

__.JPG

dansshin
Level: Powered On

Re: Image name from database

@Meneghino Thanks for taking the time to try that. I went in back into the app today and it was working with code I have save yesterday so perhaps it was cach issue.  

 

Thank you so much for your inputs! It's very much appreciated.

dansshin
Level: Powered On

Re: Image name from database

It seems to be working in design mode but when I run the app in iOS or even on Windows PowerApps app it doesn't show the images referenced as string path. Strange behavior.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (7,782)