Hi Sergiy,
I've completed the above example to display the linked file and it worked fine until: It directs you to add the JavaScript code to the image component URL property.
(1) The image component doesn't have a URL property. Is this a typo and supposed to be the Link Component URL, because I have utilised that instead?
When I invoke the Link, it opens the window as expected and shows the testfile but I also get an error on the main screen of Bad Request.
The window.open() function, still states to utilise the testfile within the coding line: xxxxxx-d117-4daf-acaa-63a5951710f3.test.pdf?
In my 1st post above I describe removing this testfile from this window function and replaced it with fileName, to get a link to the Files Name column in the Files Collection. But get an error message of: "code":"DBFG155","description":"File with name fileName not found in database.
(2) I have utilise the _user_read_service to invoke a list to be displayed, but not sure of the mapping process after that?
Part of the example pasted below:
[quote:]
If you have a list of PDF files that you would like to display in your app, that’s also easy to do.
Generate a service that returns a list of all the files (Create new Database Services). When you complete the Success (output) mapping, add the following JavaScript code to the image component URL property:
var DB_ID = '54b88d61XXXXXXXXX6676d3f5e';
var masterKey = '54545454';
return ' https://api.appery.io/rest/1/db/files/' + DB_ID + '/' + value + '?masterKey='+masterKey;
Where DB_ID and masterKey are your actual database ID and master key of your database.
Open Events panel and chose Run Javascript event for your link component. Add the following code:
window.open('https://api.appery.io/rest/1/db/files...', '_system');
Save and test your app in a browser. When you click on the link the new page is opened and your PDF file is displayed on this separate page.
The same way it works on the device. Export your app and see that when you click on the link your system browser starts to work and displays your PDF file from Appery.io database.
With that, you’re done: you’ve successfully displayed a PDF file that was uploaded to a database in your app.
[/quote]