On the tutorial page:
http://devcenter.appery.io/documentat...
It says:
"Be sure you change the PhotoDB_settings name to your Settings asset name:"
... but doesn't show how to do it.
How do you do it?
On the tutorial page:
http://devcenter.appery.io/documentat...
It says:
"Be sure you change the PhotoDB_settings name to your Settings asset name:"
... but doesn't show how to do it.
How do you do it?
Hello!
You need to form correct links to the file as shown here http://devcenter.appery.io/documentat.... To do that add to image mapping the following code:
prereturn "https://api.appery.io/rest/1/db/files/[databaseID]/" + value;/prewhere [databaseID] your DB id
Step 9 in the tutorial currently reads:
Enter the following code and click “Save”, then “Save and return”. Be sure you change the PhotoDB_settings name to your Settings asset name:
return PhotoDB_settings.photo_url + PhotoDB_settings.database_id + '/' + value;
While the answer above in your reply above will technically work, it is not good practice to hard code the databaseID directly into code. The tutorial uses the correct technique however my confusion arose from its confusing word choice and phrasing. (What is a "PhotoDB_settings name"? What is a "Settings asset name"?)
It would be MUCH, MUCH clearer if it read:
Copy and paste the following code. Replace PhotoDB with the name of your database (e.g. PhotoDB_settings becomes MydatabaseDB_settings) then click “Save” and then click “Save and return”.
return PhotoDB_settings.photo_url + PhotoDB_settings.database_id + '/' + value;
While that technically works, hardcoding the databaseID is not good practice.
The root problem turned out to be in poor wording in the tutorial. The following sentence from the tutorial:
"Be sure you change the PhotoDB_settings name to your Settings asset name:"
should be rewritten as:
"Where the code below says 'PhotoDB' be sure to replace it with the name of your database."
I had no idea what a "Settings asset name" was and it took me ages to figure out that "PhotoDB_settings name" was not a parameter somewhere. I wasted a ton of time only to find out that it was a simple string substitution in the code. (On the plus side, I learned a lot trying to figure it out.)