Page 2 of 3

Problem Loading a Pdf File

Posted: Mon Mar 09, 2015 4:29 pm
by leonardo

Any help on this?


Problem Loading a Pdf File

Posted: Mon Mar 09, 2015 6:22 pm
by leonardo

A little more info. As said earlier, the database "magpdf" has pdf files and 3 collections.

Here is one of magpdf collections, mmag. This collection references the filenames in files as shown below (but is not the actual filename of the file):
Image

Here is the magpdf files showing a set of different filenames (the real filenames needed to open the pdf files):
Image

The filenames in the mmag collection are wrongly mapped to the pdfname:
Image

In creating the service, there is no corresponding list item for files read service to map the needed filename to the pdfname on the UI:
Image

Image

How should I map the filenames in the database files to the label component of the UI to capture the filename and use it to open the pdf?


Problem Loading a Pdf File

Posted: Tue Mar 10, 2015 3:56 pm
by leonardo

Just not sure what else to do here to get an answer...


Problem Loading a Pdf File

Posted: Wed Mar 11, 2015 2:02 pm
by Alena Prykhodko

Dear Leonardo,

We are striving to reply all users as faster as possible.
We'll get back with updates as soon as have new.


Problem Loading a Pdf File

Posted: Wed Mar 11, 2015 5:23 pm
by leonardo

Thanks. I appreciate that, because I'm stuck and can't proceed.


Problem Loading a Pdf File

Posted: Fri Mar 13, 2015 3:01 am
by Yurii Orishchuk

Hi Leonardo,

It seems you have passed to your code not correct fileName.

Please try following JS code:

pre

var thepdf = $(this).find("[name=pdfname]").text(); // thepdf here is: h2013-2.pdf

var pdf= 'https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/' + thepdf;
masterKey='abe75e48-f875-47be-946a-502e7d7566b2';

console.log("pdf = '" + pdf + "'");

window.open(pdf, '_system');

/pre

Then open console and take a look what actual URL you have.

Thanks.


Problem Loading a Pdf File

Posted: Fri Mar 13, 2015 7:28 am
by leonardo

Hi Yurii:
This is the console info:
code
GET https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/h2013-4.pdf 404 (Not Found)
Navigated to https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/h2013-4.pdf
/code

Also, no matter what item I clicked, it still gives the same message without updating the actual pdf clicked.

It seems to me that the issue is that the database substituted a unique id instead of the real filename when the items were uploaded. If I manually put the unique id and the filename it works, eg.
code
'https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/' + '4b23fed0-cad4-47b5-974c-1d825d99953a.h2014-3.pdf'
/code

The key is how to get the long id/filename of the file collection. The Url seems to be correct, it's just accessing that piece of information that's the problem. Couldn't imagine it would be this hard.

I've shared the app, please feel free to check it out.

Thanks for your help.


Problem Loading a Pdf File

Posted: Mon Mar 16, 2015 1:33 am
by Yurii Orishchuk

Hi Leonardo,

pre

https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/h2013-4.pdf

/pre

It seems your link uses file "originalName" you need to use file "fileName" instead.

See details on screen shot: http://prntscr.com/6hc5e2/direct

Regards.


Problem Loading a Pdf File

Posted: Mon Mar 16, 2015 5:48 pm
by leonardo

Hi Yurii:

I'm not sure you understand my plight here. As expressed above, I already know that is the originalName and that I need the fileName. But as I mentioned, my page is mapped to a separate collection, but I need to map the fileName from the file Collection to it. That is what I'm having problem with.

So far, I see that to have access to the file collection I need to create a login Service. I have done that and can now see Response results from a test from the file Collection. But still, I couldn't get the filename to show from it. These are my current settings:
Image
Image
Image

Also, from your link I see that the Owner and ACL info are filled in your example. Mine is not. Does that make a difference? Where is that setting done?

Image

Also, by the way, say I select an item that has a value of "2013-1" in the UI, how can I code it in javascript to says: select the file that has "2013-1" in the filename? If I can do that, are there prerequisite settings I need to do first to access the name?


Problem Loading a Pdf File

Posted: Wed Mar 18, 2015 4:54 am
by Yurii Orishchuk

Hi leonardo,

It seems you have incorrect response parameters for your read service(but i'm not sure cause of not enough info):
Details: http://prntscr.com/6i6p4v/direct

Please describe your app workflow step-by-step.

For example:

  1. User uploads the file.

  2. User see all uploaded files.

  3. User check one one of them.
    .......

    Thanks.