Displaying default Image If no Image exists in database

Displaying default Image If no Image exists in database

  
Hi,

How do I display a default Image if no image exists in the database?
The image that I selected for the Database Image at design time, is not being displayed at runtime (if no image exists in the database)

The result looks like this 

The html tag that is generated if the image does not exist:
<img alt="" src="/SampleApp/_image.aspx/CU01hvW-FBul0aaLn0Op/" style="height:100px;width:100px;">

If the image exists, then this tag is generated:
<img alt="" src="/SampleApp/_image.aspx/CU01hvW-FBul0aaLn0Oq/myimage.jpg" style="height:100px;width:100px;">

What am I doing wrong?

To replicate the scenario, From the attached e-space, Create a new Contact without selecting an image

Thanks & Regards,
Charles.
Hi Charles,

You can incluse that image widget inside an if and check if any image exists for that row.
If not exists, you can put an image in the False part, letting it as static..
Simple as this..

Regards,
Gonçalo M.



In the documentaion it's mentioned that
Default Image

The image you select for the Database Image at design time is used as follows:

  • Preview image at design time;

  • Displayed image at runtime if no image exists in the database.

http://www.outsystems.com/help/servicestudio/7.0/Miscellaneous/Displaying_images/Using_Database_Images.htm

Thanks Gonçalo, but  I am looking to leverage this functionality.

Yes that is the way it works..I just gave a workaround if you have some problem.
Please attach your eSpace after passing it in the IPP, since I'm not able to use it on my community edition.
I'll definately use the if clause as a last resort

Attached: Updated Oml passed through IPP

Edit:  the oml still doesn't work in the community edition.
I used this link http://www.outsystems.com/ipp .Is this the correct one?

Edit2: Posted the IPP issue on the forum
hope this gets resolved soon
http://www.outsystems.com/forums/discussion/10258/ipp-issues/
Charles Colaço wrote:
I'll definately use the if clause as a last resort

Attached: Updated Oml passed through IPP

Edit:  the oml still doesn't work in the community edition.
I used this link http://www.outsystems.com/ipp .Is this the correct one?
 You have to set the destination licence as 000.000.000.000.000.000.000.000 to be able to work in the community edition.
The link is correct.
 
Hi Gonçalo,

I set the destination code to 000.000.000.000.000.000.000.000
and get this error message
The activation code is not valid. Please check if you typed it correctly and try again.

Thanks,
Charles.
Try this one, to avoid wasting more time ;)
I think the error is related with the Platform version.

GM
I ran ApplicationTestImage and entered the following
File Name: image.jpg
Mime Type: image/jpeg
Chose a jpg image 
and Clicked Save.

When I click Save I get this error
"OUTSYSTEMS_DEV"."DBO"."OSUSR_TFS_IMAGE" with key 0 was not updated 

 

 

Sorry,
Uploaded the wrong version..

GM
When I choose an image and click Save
I get this error
Invalid info - No Image 
It was just a problem in an "If-condition"..With the worry it passed..
But the goal is for you to see that the image widget works as the documentation says..
Thanks  Gonçalo,
It works now. I am able to view the default Image
I swapped the connectors for the If condition (ImageId = NullIdentifier() and ER_ImageEdit.Record.IMAGE.FileName = "")
Summary
To get the Default Image to be displayed at runtime if no Image Exists in the database 
You  must have another supporting entity with attributes Id, Image(type binary)
and your main entity must have a reference attribute to the supporting entity's Id

If you only have one entity with an attribute Image(type binary) ,
then the platform doesn't display a default image at runtime if no Image exists in the database.

I've removed the IPP from the Sample eSpace.

Hope this helps.