Page 2 of 2

Loading image from database

Posted: Fri Aug 08, 2014 9:01 pm
by ahmet Karamanli

Hi I HAVE equivalent issue: I want to show 2 images from a list of record. displaying text values from database is not a issue. But if i try to do the same for 2 images in the same row I got no image on the screen(mobile) Image

Image

What do I need do more?

Adding users to each row in the database that contain a Image?

Add a Java script to the "Assert" field .

Note: I'm Abel to show a Image from the FILE database If I check the STATUS field and make my decision based on the status field, via a LOCAL STORAGE variable.

But when I use Local starage variable then I'm using the result of a previus ROW in the current row, so there is a delay and the results are now wrong because local variable stores a value now which can be used for the next row, so result is not valid.

I want to show the IMAGE file which is included in the same row as the row I'm analyzing. SO the following code is not usable for me:

var str=localStorage.getItem('var_status2');

if (str == 'halal')

{

return "https://api.appery.io/rest/1/db/files...";

}
else
{
if (str == 'doubtful')
{
return "https://api.appery.io/rest/1/db/files...";
}
else
{
return "https://api.appery.io/rest/1/db/files...";
}
}

Code displays a Image but the wrong one.

Do you have a solution for me

Image


Loading image from database

Posted: Mon Aug 11, 2014 1:15 am
by Yurii Orishchuk

Hi Ahmet,

You don't need to use LSV for this goal.

Please follow these steps:

1 Delete link to "var_status2".

2 Make link from response parameter you need to imageComponent_asset property. See details http://prntscr.com/4ble8b/direct

3 Click on "Add JS" for just created link. http://prntscr.com/4bleju/direct

4 Populate this JS with code you need. For example:

pre

//value = is what you have linked on 2nd step.
var str = value;

if (str == 'halal'){
return "https://api.appery.io/rest/1/db/files...";
}
else {
if (str == 'doubtful') {
return "https://api.appery.io/rest/1/db/files...";
} else {
return "https://api.appery.io/rest/1/db/files...";
}
}

/pre

Regards.