cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate IV
Advocate IV

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
Highlighted
Community Champion
Community Champion

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
Community Champion
Community Champion

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.

 

Highlighted
Advocate IV
Advocate IV

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)
Highlighted
Community Champion
Community Champion

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

Highlighted
Advocate IV
Advocate IV

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

Highlighted
Community Champion
Community Champion

Re: Image name from database

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

Highlighted
Advocate IV
Advocate IV

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?

Highlighted
Community Champion
Community Champion

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

Highlighted
Advocate IV
Advocate IV

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.

Highlighted
Advocate IV
Advocate IV

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,496)